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

Side by Side Diff: gm/clip_strokerect.cpp

Issue 777643003: use ClipOp instead of SkRegion for clipping (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 | « gm/circularclips.cpp ('k') | gm/complexclip.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"
(...skipping 18 matching lines...) Expand all
29 p.setColor(SK_ColorRED); 29 p.setColor(SK_ColorRED);
30 p.setAntiAlias(true); 30 p.setAntiAlias(true);
31 p.setStyle(SkPaint::kStroke_Style); 31 p.setStyle(SkPaint::kStroke_Style);
32 p.setStrokeWidth(22); 32 p.setStrokeWidth(22);
33 33
34 SkRect r = SkRect::MakeXYWH(20, 20, 100, 100); 34 SkRect r = SkRect::MakeXYWH(20, 20, 100, 100);
35 // setting the height of this to 19 causes failure 35 // setting the height of this to 19 causes failure
36 SkRect rect = SkRect::MakeXYWH(20, 0, 100, 20); 36 SkRect rect = SkRect::MakeXYWH(20, 0, 100, 20);
37 37
38 canvas->save(); 38 canvas->save();
39 canvas->clipRect(rect, SkRegion::kReplace_Op, true); 39 canvas->legacyClipRect(rect, SkRegion::kReplace_Op, true);
40 canvas->drawRect(r, p); 40 canvas->drawRect(r, p);
41 canvas->restore(); 41 canvas->restore();
42 42
43 p.setColor(SK_ColorBLUE); 43 p.setColor(SK_ColorBLUE);
44 p.setStrokeWidth(2); 44 p.setStrokeWidth(2);
45 canvas->drawRect(rect, p); 45 canvas->drawRect(rect, p);
46 46
47 p.setColor(SK_ColorRED); 47 p.setColor(SK_ColorRED);
48 p.setAntiAlias(true); 48 p.setAntiAlias(true);
49 p.setStyle(SkPaint::kStroke_Style); 49 p.setStyle(SkPaint::kStroke_Style);
50 p.setStrokeWidth(22); 50 p.setStrokeWidth(22);
51 51
52 SkRect r2 = SkRect::MakeXYWH(20, 140, 100, 100); 52 SkRect r2 = SkRect::MakeXYWH(20, 140, 100, 100);
53 // setting the height of this to 19 causes failure 53 // setting the height of this to 19 causes failure
54 SkRect rect2 = SkRect::MakeXYWH(20, 120, 100, 19); 54 SkRect rect2 = SkRect::MakeXYWH(20, 120, 100, 19);
55 55
56 canvas->save(); 56 canvas->save();
57 canvas->clipRect(rect2, SkRegion::kReplace_Op, true); 57 canvas->legacyClipRect(rect2, SkRegion::kReplace_Op, true);
58 canvas->drawRect(r2, p); 58 canvas->drawRect(r2, p);
59 canvas->restore(); 59 canvas->restore();
60 60
61 p.setColor(SK_ColorBLUE); 61 p.setColor(SK_ColorBLUE);
62 p.setStrokeWidth(2); 62 p.setStrokeWidth(2);
63 canvas->drawRect(rect2, p); 63 canvas->drawRect(rect2, p);
64 } 64 }
65 65
66 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; } 66 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; }
67 67
68 private: 68 private:
69 typedef skiagm::GM INHERITED; 69 typedef skiagm::GM INHERITED;
70 }; 70 };
71 71
72 DEF_GM( return SkNEW(ClipStrokeRectGM); ) 72 DEF_GM( return SkNEW(ClipStrokeRectGM); )
73 73
OLDNEW
« no previous file with comments | « gm/circularclips.cpp ('k') | gm/complexclip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698