From 49124378913f3467eb67e653b3b48f80899a3f37 Mon Sep 17 00:00:00 2001 From: reed Date: Mon, 20 Apr 2015 09:10:31 -0700 Subject: adjust GM to have a final opaque bg, to make it easier to triage BUG=skia: TBR= Review URL: https://codereview.chromium.org/1085333003 --- gm/imagefilters.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'gm') 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 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); } } -- cgit v1.2.3