Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(972)

Unified Diff: gm/imagefilters.cpp

Issue 1085333003: adjust GM to have a final opaque bg, to make it easier to triage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefilters.cpp
diff --git a/gm/imagefilters.cpp b/gm/imagefilters.cpp
index c096c24b3482d47eca3388cbe86938f01fa55361..54e50e47f2dc0d98dcabbcc6815f4a4466405b2b 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);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698