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

Unified Diff: gm/aaclip.cpp

Issue 2296703003: test dont-clip-layer (Closed)
Patch Set: allow feature to be tested all the time Created 4 years, 3 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 | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/aaclip.cpp
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp
index 1cb71577990ba75759a5c72c42db5ec42d4eb9b3..adc776fe680120f6bbd56d09aca3b4701b77e1f0 100644
--- a/gm/aaclip.cpp
+++ b/gm/aaclip.cpp
@@ -9,6 +9,27 @@
#include "SkCanvas.h"
#include "SkPath.h"
+static void do_draw(SkCanvas* canvas, const SkRect& r) {
+ SkPaint paint;
+ paint.setXfermodeMode(SkXfermode::kSrc_Mode);
+ paint.setColor(0x800000FF);
+ canvas->drawRect(r, paint);
+}
+
+DEF_SIMPLE_GM(dont_clip_to_layer, canvas, 350, 120) {
mtklein 2016/09/06 14:05:19 were there going to be 2 more horizontally?
reed1 2016/09/06 14:36:32 The scrolling code in android sometimes does that:
mtklein 2016/09/06 14:51:21 Sorry, was just wondering about why this was so wi
reed1 2016/09/06 15:06:29 Ah, gotcha. Will fix.
+ SkRect r { 10, 10, 110, 110 };
+ SkRect r0 = SkRect::MakeXYWH(r.left(), r.top(), r.width(), r.height()/2);
+
+ SkCanvas::SaveLayerRec rec;
+ rec.fPaint = nullptr;
+ rec.fBounds = &r0;
+ rec.fBackdrop = nullptr;
+ rec.fSaveLayerFlags = 1 << 31;//SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag;
+ canvas->saveLayer(rec);
mtklein 2016/09/06 14:05:19 Can you add a comment about the effect that we're
reed1 2016/09/06 14:36:32 Done.
+ do_draw(canvas, r);
+ canvas->restore();
+}
+
/** Draw a 2px border around the target, then red behind the target;
set the clip to match the target, then draw >> the target in blue.
*/
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698