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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
11 11
12 static void do_draw(SkCanvas* canvas, const SkRect& r) {
13 SkPaint paint;
14 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
15 paint.setColor(0x800000FF);
16 canvas->drawRect(r, paint);
17 }
18
19 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.
20 SkRect r { 10, 10, 110, 110 };
21 SkRect r0 = SkRect::MakeXYWH(r.left(), r.top(), r.width(), r.height()/2);
22
23 SkCanvas::SaveLayerRec rec;
24 rec.fPaint = nullptr;
25 rec.fBounds = &r0;
26 rec.fBackdrop = nullptr;
27 rec.fSaveLayerFlags = 1 << 31;//SkCanvas::kDontClipToLayer_Legacy_SaveLayerF lag;
28 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.
29 do_draw(canvas, r);
30 canvas->restore();
31 }
32
12 /** Draw a 2px border around the target, then red behind the target; 33 /** Draw a 2px border around the target, then red behind the target;
13 set the clip to match the target, then draw >> the target in blue. 34 set the clip to match the target, then draw >> the target in blue.
14 */ 35 */
15 36
16 static void draw(SkCanvas* canvas, SkRect& target, int x, int y) { 37 static void draw(SkCanvas* canvas, SkRect& target, int x, int y) {
17 SkPaint borderPaint; 38 SkPaint borderPaint;
18 borderPaint.setColor(SkColorSetRGB(0x0, 0xDD, 0x0)); 39 borderPaint.setColor(SkColorSetRGB(0x0, 0xDD, 0x0));
19 borderPaint.setAntiAlias(true); 40 borderPaint.setAntiAlias(true);
20 SkPaint backgroundPaint; 41 SkPaint backgroundPaint;
21 backgroundPaint.setColor(SkColorSetRGB(0xDD, 0x0, 0x0)); 42 backgroundPaint.setColor(SkColorSetRGB(0xDD, 0x0, 0x0));
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 canvas->translate(80, 10); 275 canvas->translate(80, 10);
255 this->drawAndClip(canvas, fVPath, 200, 0); 276 this->drawAndClip(canvas, fVPath, 200, 0);
256 canvas->translate(0, 200); 277 canvas->translate(0, 200);
257 this->drawAndClip(canvas, fHPath, 200, 0); 278 this->drawAndClip(canvas, fHPath, 200, 0);
258 } 279 }
259 280
260 private: 281 private:
261 typedef skiagm::GM INHERITED; 282 typedef skiagm::GM INHERITED;
262 }; 283 };
263 DEF_GM(return new ClipCubicGM;) 284 DEF_GM(return new ClipCubicGM;)
OLDNEW
« 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