aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-07-16 07:01:39 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-16 07:01:40 -0700
commit767d273ea0948e4f61d318bec58ce417cdc470df (patch)
tree2fbdd42be5a05f32f8300c4adbe9ddaed2d9e3dd /gm
parent6fb0b6779e40ce05c20cf279f0ecff31fa3cd60d (diff)
Replace buggy_blend_modes GM with an exhaustive test.
The new test is disabled by default, as it's quite slow. We can run it if we suspect problems by passing -x to DM. This test would have been failing before the bug fix, and now is passing. Assuming the Priv on the end means it's not considered public API... TBR=reed@google.com BUG=skia:4052 Review URL: https://codereview.chromium.org/1228333003
Diffstat (limited to 'gm')
-rw-r--r--gm/buggy_blend_modes.cpp52
1 files changed, 0 insertions, 52 deletions
diff --git a/gm/buggy_blend_modes.cpp b/gm/buggy_blend_modes.cpp
deleted file mode 100644
index 21a6798fe0..0000000000
--- a/gm/buggy_blend_modes.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkCanvas.h"
-#include "SkGradientShader.h"
-#include "gm.h"
-
-// This GM reproduces what I think are overflow bugs in the CPU implementations of a
-// couple xfermodes. I've marked non-obvious keys to reproducing the bug // Essential!
-DEF_SIMPLE_GM(buggy_blend_modes, canvas, 800, 200) {
- const auto tiling = SkShader::kClamp_TileMode;
- const auto flags = SkGradientShader::kInterpolateColorsInPremul_Flag; // Essential!
-
- SkAutoTUnref<SkShader> cyanH, magentaV;
- {
- SkPoint pts[] = { {0,0}, {200, 0} };
- SkColor colors[] = { 0x00000000, 0xFF00FFFF };
- cyanH.reset(
- SkGradientShader::CreateLinear(pts, colors, nullptr, 2, tiling, flags, nullptr));
- }
- {
- SkPoint pts[] = { {0,0}, {0, 200} };
- SkColor colors[] = { 0x00000000, 0xFFFF00FF };
- magentaV.reset(
- SkGradientShader::CreateLinear(pts, colors, nullptr, 2, tiling, flags, nullptr));
- }
-
- SkXfermode::Mode modes[] = {
- SkXfermode::kDarken_Mode, // Looks ok?
- SkXfermode::kHardLight_Mode, // Definitely wrong.
- SkXfermode::kLighten_Mode, // Definitely wrong.
- SkXfermode::kOverlay_Mode, // Same code as kHardLight_Mode.
- };
-
- canvas->clear(SK_ColorWHITE);
- for (auto mode : modes) {
- canvas->saveLayer(nullptr, nullptr); // Essential!
- SkPaint h, v;
- h.setShader(cyanH);
- v.setShader(magentaV);
- v.setXfermodeMode(mode);
- canvas->drawRect(SkRect::MakeWH(200,200), h);
- canvas->drawRect(SkRect::MakeWH(200,200), v);
- canvas->restore();
-
- canvas->translate(200, 0);
- }
-}