aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/imagefilters.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-04-20 09:10:31 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-20 09:10:31 -0700
commit49124378913f3467eb67e653b3b48f80899a3f37 (patch)
tree91701c46ae185edfb08fd54a791c2c95e04bfa5b /gm/imagefilters.cpp
parent1049f1246e7be4ccb68001361efceb8933e6f81c (diff)
adjust GM to have a final opaque bg, to make it easier to triage
BUG=skia: TBR= Review URL: https://codereview.chromium.org/1085333003
Diffstat (limited to 'gm/imagefilters.cpp')
-rw-r--r--gm/imagefilters.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/gm/imagefilters.cpp b/gm/imagefilters.cpp
index c096c24b34..54e50e47f2 100644
--- a/gm/imagefilters.cpp
+++ b/gm/imagefilters.cpp
@@ -25,6 +25,15 @@ protected:
SkISize onISize() override { return SkISize::Make(480, 480); }
void doDraw(SkCanvas* canvas, SkXfermode::Mode mode, SkImageFilter* imf) {
+ SkAutoCanvasRestore acr(canvas, true);
+ canvas->clipRect(SkRect::MakeWH(220, 220));
+
+ // want to force a layer, so modes like DstIn can combine meaningfully, but the final
+ // image can still be shown against our default (opaque) background. non-opaque GMs
+ // are a lot more trouble to compare/triage.
+ canvas->saveLayer(NULL, NULL);
+ canvas->drawColor(SK_ColorGREEN);
+
SkPaint paint;
paint.setAntiAlias(true);
@@ -34,13 +43,15 @@ protected:
paint.setColor(SK_ColorRED);
canvas->drawOval(r0, paint);
- paint.setColor(0x800000FF);
+ paint.setColor(0x660000FF);
paint.setImageFilter(imf);
paint.setXfermodeMode(mode);
canvas->drawOval(r1, paint);
}
void onDraw(SkCanvas* canvas) override {
+ canvas->translate(10, 10);
+
// just need an imagefilter to trigger the code-path (which creates a tmp layer)
SkAutoTUnref<SkImageFilter> imf(SkImageFilter::CreateMatrixFilter(SkMatrix::I(),
kNone_SkFilterQuality));
@@ -52,11 +63,11 @@ protected:
for (size_t i = 0; i < SK_ARRAY_COUNT(modes); ++i) {
canvas->save();
this->doDraw(canvas, modes[i], NULL);
- canvas->translate(250, 0);
+ canvas->translate(240, 0);
this->doDraw(canvas, modes[i], imf);
canvas->restore();
- canvas->translate(0, 250);
+ canvas->translate(0, 240);
}
}