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

Side by Side Diff: gm/complexclip2.cpp

Issue 2355483002: abstract name of clipping ops, to transtion to a more restricted set (Closed)
Patch Set: no need for ifdef for globals 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 | « gm/complexclip.cpp ('k') | gm/complexclip3.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 8
9 #include "gm.h" 9 #include "gm.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 fRects[3].set(xA, yC, xD, yF); 76 fRects[3].set(xA, yC, xD, yF);
77 fRRects[3].setRectXY(fRects[3], 7, 7); 77 fRRects[3].setRectXY(fRects[3], 7, 7);
78 fPaths[3].addRoundRect(fRects[3], 5, 5); 78 fPaths[3].addRoundRect(fRects[3], 5, 5);
79 fRectColors[3] = SK_ColorYELLOW; 79 fRectColors[3] = SK_ColorYELLOW;
80 80
81 fRects[4].set(xC, yC, xF, yF); 81 fRects[4].set(xC, yC, xF, yF);
82 fRRects[4].setRectXY(fRects[4], 7, 7); 82 fRRects[4].setRectXY(fRects[4], 7, 7);
83 fPaths[4].addRoundRect(fRects[4], 5, 5); 83 fPaths[4].addRoundRect(fRects[4], 5, 5);
84 fRectColors[4] = SK_ColorCYAN; 84 fRectColors[4] = SK_ColorCYAN;
85 85
86 SkRegion::Op ops[] = { 86 SkCanvas::ClipOp ops[] = {
87 SkRegion::kDifference_Op, 87 SkCanvas::kDifference_Op,
88 SkRegion::kIntersect_Op, 88 SkCanvas::kIntersect_Op,
89 SkRegion::kUnion_Op, 89 SkCanvas::kUnion_Op,
90 SkRegion::kXOR_Op, 90 SkCanvas::kXOR_Op,
91 SkRegion::kReverseDifference_Op, 91 SkCanvas::kReverseDifference_Op,
92 SkRegion::kReplace_Op, 92 SkCanvas::kReplace_Op,
93 }; 93 };
94 94
95 SkRandom r; 95 SkRandom r;
96 for (int i = 0; i < kRows; ++i) { 96 for (int i = 0; i < kRows; ++i) {
97 for (int j = 0; j < kCols; ++j) { 97 for (int j = 0; j < kCols; ++j) {
98 for (int k = 0; k < 5; ++k) { 98 for (int k = 0; k < 5; ++k) {
99 fOps[j*kRows+i][k] = ops[r.nextU() % SK_ARRAY_COUNT(ops)]; 99 fOps[j*kRows+i][k] = ops[r.nextU() % SK_ARRAY_COUNT(ops)];
100 } 100 }
101 } 101 }
102 } 102 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 193 }
194 } 194 }
195 } 195 }
196 private: 196 private:
197 Clip fClip; 197 Clip fClip;
198 bool fAntiAlias; 198 bool fAntiAlias;
199 SkRect fRects[5]; 199 SkRect fRects[5];
200 SkRRect fRRects[5]; 200 SkRRect fRRects[5];
201 SkPath fPaths[5]; 201 SkPath fPaths[5];
202 SkColor fRectColors[5]; 202 SkColor fRectColors[5];
203 SkRegion::Op fOps[kRows * kCols][5]; 203 SkCanvas::ClipOp fOps[kRows * kCols][5];
204 SkScalar fWidth; 204 SkScalar fWidth;
205 SkScalar fHeight; 205 SkScalar fHeight;
206 SkScalar fTotalWidth; 206 SkScalar fTotalWidth;
207 SkScalar fTotalHeight; 207 SkScalar fTotalHeight;
208 208
209 typedef GM INHERITED; 209 typedef GM INHERITED;
210 }; 210 };
211 211
212 ////////////////////////////////////////////////////////////////////////////// 212 //////////////////////////////////////////////////////////////////////////////
213 213
214 // bw 214 // bw
215 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kRect_Clip, false); ) 215 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kRect_Clip, false); )
216 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kRRect_Clip, false); ) 216 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kRRect_Clip, false); )
217 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kPath_Clip, false); ) 217 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kPath_Clip, false); )
218 218
219 // aa 219 // aa
220 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kRect_Clip, true); ) 220 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kRect_Clip, true); )
221 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kRRect_Clip, true); ) 221 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kRRect_Clip, true); )
222 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kPath_Clip, true); ) 222 DEF_GM( return new ComplexClip2GM(ComplexClip2GM::kPath_Clip, true); )
223 223
224 } 224 }
OLDNEW
« no previous file with comments | « gm/complexclip.cpp ('k') | gm/complexclip3.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698