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

Side by Side Diff: gm/cubicpaths.cpp

Issue 2300623005: Replace a lot of 'static const' with 'constexpr' or 'const'. (Closed)
Patch Set: small msvc concession 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/convexpolyeffect.cpp ('k') | gm/dashcircle.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 "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 canvas->clipRect(clip); 151 canvas->clipRect(clip);
152 canvas->drawPath(path, paint); 152 canvas->drawPath(path, paint);
153 canvas->restore(); 153 canvas->restore();
154 } 154 }
155 155
156 virtual void onDraw(SkCanvas* canvas) { 156 virtual void onDraw(SkCanvas* canvas) {
157 struct FillAndName { 157 struct FillAndName {
158 SkPath::FillType fFill; 158 SkPath::FillType fFill;
159 const char* fName; 159 const char* fName;
160 }; 160 };
161 static const FillAndName gFills[] = { 161 constexpr FillAndName gFills[] = {
162 {SkPath::kWinding_FillType, "Winding"}, 162 {SkPath::kWinding_FillType, "Winding"},
163 {SkPath::kEvenOdd_FillType, "Even / Odd"}, 163 {SkPath::kEvenOdd_FillType, "Even / Odd"},
164 {SkPath::kInverseWinding_FillType, "Inverse Winding"}, 164 {SkPath::kInverseWinding_FillType, "Inverse Winding"},
165 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"}, 165 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"},
166 }; 166 };
167 struct StyleAndName { 167 struct StyleAndName {
168 SkPaint::Style fStyle; 168 SkPaint::Style fStyle;
169 const char* fName; 169 const char* fName;
170 }; 170 };
171 static const StyleAndName gStyles[] = { 171 constexpr StyleAndName gStyles[] = {
172 {SkPaint::kFill_Style, "Fill"}, 172 {SkPaint::kFill_Style, "Fill"},
173 {SkPaint::kStroke_Style, "Stroke"}, 173 {SkPaint::kStroke_Style, "Stroke"},
174 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"}, 174 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"},
175 }; 175 };
176 struct CapAndName { 176 struct CapAndName {
177 SkPaint::Cap fCap; 177 SkPaint::Cap fCap;
178 SkPaint::Join fJoin; 178 SkPaint::Join fJoin;
179 const char* fName; 179 const char* fName;
180 }; 180 };
181 static const CapAndName gCaps[] = { 181 constexpr CapAndName gCaps[] = {
182 {SkPaint::kButt_Cap, SkPaint::kBevel_Join, "Butt"}, 182 {SkPaint::kButt_Cap, SkPaint::kBevel_Join, "Butt"},
183 {SkPaint::kRound_Cap, SkPaint::kRound_Join, "Round"}, 183 {SkPaint::kRound_Cap, SkPaint::kRound_Join, "Round"},
184 {SkPaint::kSquare_Cap, SkPaint::kBevel_Join, "Square"} 184 {SkPaint::kSquare_Cap, SkPaint::kBevel_Join, "Square"}
185 }; 185 };
186 struct PathAndName { 186 struct PathAndName {
187 SkPath fPath; 187 SkPath fPath;
188 const char* fName; 188 const char* fName;
189 }; 189 };
190 PathAndName path; 190 PathAndName path;
191 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); 191 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 canvas->clipRect(clip); 295 canvas->clipRect(clip);
296 canvas->drawPath(path, paint); 296 canvas->drawPath(path, paint);
297 canvas->restore(); 297 canvas->restore();
298 } 298 }
299 299
300 virtual void onDraw(SkCanvas* canvas) { 300 virtual void onDraw(SkCanvas* canvas) {
301 struct FillAndName { 301 struct FillAndName {
302 SkPath::FillType fFill; 302 SkPath::FillType fFill;
303 const char* fName; 303 const char* fName;
304 }; 304 };
305 static const FillAndName gFills[] = { 305 constexpr FillAndName gFills[] = {
306 {SkPath::kWinding_FillType, "Winding"}, 306 {SkPath::kWinding_FillType, "Winding"},
307 {SkPath::kEvenOdd_FillType, "Even / Odd"}, 307 {SkPath::kEvenOdd_FillType, "Even / Odd"},
308 {SkPath::kInverseWinding_FillType, "Inverse Winding"}, 308 {SkPath::kInverseWinding_FillType, "Inverse Winding"},
309 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"}, 309 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"},
310 }; 310 };
311 struct StyleAndName { 311 struct StyleAndName {
312 SkPaint::Style fStyle; 312 SkPaint::Style fStyle;
313 const char* fName; 313 const char* fName;
314 }; 314 };
315 static const StyleAndName gStyles[] = { 315 constexpr StyleAndName gStyles[] = {
316 {SkPaint::kFill_Style, "Fill"}, 316 {SkPaint::kFill_Style, "Fill"},
317 {SkPaint::kStroke_Style, "Stroke"}, 317 {SkPaint::kStroke_Style, "Stroke"},
318 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"}, 318 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"},
319 }; 319 };
320 struct CapAndName { 320 struct CapAndName {
321 SkPaint::Cap fCap; 321 SkPaint::Cap fCap;
322 SkPaint::Join fJoin; 322 SkPaint::Join fJoin;
323 const char* fName; 323 const char* fName;
324 }; 324 };
325 static const CapAndName gCaps[] = { 325 constexpr CapAndName gCaps[] = {
326 {SkPaint::kButt_Cap, SkPaint::kBevel_Join, "Butt"}, 326 {SkPaint::kButt_Cap, SkPaint::kBevel_Join, "Butt"},
327 {SkPaint::kRound_Cap, SkPaint::kRound_Join, "Round"}, 327 {SkPaint::kRound_Cap, SkPaint::kRound_Join, "Round"},
328 {SkPaint::kSquare_Cap, SkPaint::kBevel_Join, "Square"} 328 {SkPaint::kSquare_Cap, SkPaint::kBevel_Join, "Square"}
329 }; 329 };
330 struct PathAndName { 330 struct PathAndName {
331 SkPath fPath; 331 SkPath fPath;
332 const char* fName; 332 const char* fName;
333 }; 333 };
334 PathAndName path; 334 PathAndName path;
335 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); 335 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 path.cubicTo(31.5f, 1.5f, 3.5f, 4.5f, 29, 29); 425 path.cubicTo(31.5f, 1.5f, 3.5f, 4.5f, 29, 29);
426 canvas->drawPath(path, p); 426 canvas->drawPath(path, p);
427 } 427 }
428 428
429 ////////////////////////////////////////////////////////////////////////////// 429 //////////////////////////////////////////////////////////////////////////////
430 430
431 DEF_GM( return new CubicPathGM; ) 431 DEF_GM( return new CubicPathGM; )
432 DEF_GM( return new CubicClosePathGM; ) 432 DEF_GM( return new CubicClosePathGM; )
433 DEF_GM( return new ClippedCubicGM; ) 433 DEF_GM( return new ClippedCubicGM; )
434 DEF_GM( return new ClippedCubic2GM; ) 434 DEF_GM( return new ClippedCubic2GM; )
OLDNEW
« no previous file with comments | « gm/convexpolyeffect.cpp ('k') | gm/dashcircle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698