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

Side by Side Diff: gm/linepaths.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/lightingshader2.cpp ('k') | gm/megalooper.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 15 matching lines...) Expand all
26 canvas->clipRect(clip); 26 canvas->clipRect(clip);
27 canvas->drawPath(path, paint); 27 canvas->drawPath(path, paint);
28 canvas->restore(); 28 canvas->restore();
29 } 29 }
30 30
31 static void draw(SkCanvas* canvas, bool doClose) { 31 static void draw(SkCanvas* canvas, bool doClose) {
32 struct FillAndName { 32 struct FillAndName {
33 SkPath::FillType fFill; 33 SkPath::FillType fFill;
34 const char* fName; 34 const char* fName;
35 }; 35 };
36 static const FillAndName gFills[] = { 36 constexpr FillAndName gFills[] = {
37 {SkPath::kWinding_FillType, "Winding"}, 37 {SkPath::kWinding_FillType, "Winding"},
38 {SkPath::kEvenOdd_FillType, "Even / Odd"}, 38 {SkPath::kEvenOdd_FillType, "Even / Odd"},
39 {SkPath::kInverseWinding_FillType, "Inverse Winding"}, 39 {SkPath::kInverseWinding_FillType, "Inverse Winding"},
40 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"}, 40 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"},
41 }; 41 };
42 struct StyleAndName { 42 struct StyleAndName {
43 SkPaint::Style fStyle; 43 SkPaint::Style fStyle;
44 const char* fName; 44 const char* fName;
45 }; 45 };
46 static const StyleAndName gStyles[] = { 46 constexpr StyleAndName gStyles[] = {
47 {SkPaint::kFill_Style, "Fill"}, 47 {SkPaint::kFill_Style, "Fill"},
48 {SkPaint::kStroke_Style, "Stroke"}, 48 {SkPaint::kStroke_Style, "Stroke"},
49 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"}, 49 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"},
50 }; 50 };
51 struct CapAndName { 51 struct CapAndName {
52 SkPaint::Cap fCap; 52 SkPaint::Cap fCap;
53 SkPaint::Join fJoin; 53 SkPaint::Join fJoin;
54 const char* fName; 54 const char* fName;
55 }; 55 };
56 static const CapAndName gCaps[] = { 56 constexpr CapAndName gCaps[] = {
57 {SkPaint::kButt_Cap, SkPaint::kBevel_Join, "Butt"}, 57 {SkPaint::kButt_Cap, SkPaint::kBevel_Join, "Butt"},
58 {SkPaint::kRound_Cap, SkPaint::kRound_Join, "Round"}, 58 {SkPaint::kRound_Cap, SkPaint::kRound_Join, "Round"},
59 {SkPaint::kSquare_Cap, SkPaint::kBevel_Join, "Square"} 59 {SkPaint::kSquare_Cap, SkPaint::kBevel_Join, "Square"}
60 }; 60 };
61 struct PathAndName { 61 struct PathAndName {
62 SkPath fPath; 62 SkPath fPath;
63 const char* fName; 63 const char* fName;
64 }; 64 };
65 PathAndName path; 65 PathAndName path;
66 path.fPath.moveTo(25*SK_Scalar1, 15*SK_Scalar1); 66 path.fPath.moveTo(25*SK_Scalar1, 15*SK_Scalar1);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 canvas->restore(); 144 canvas->restore();
145 canvas->restore(); 145 canvas->restore();
146 } 146 }
147 DEF_SIMPLE_GM(linepath, canvas, 1240, 390) { 147 DEF_SIMPLE_GM(linepath, canvas, 1240, 390) {
148 draw(canvas, false); 148 draw(canvas, false);
149 } 149 }
150 DEF_SIMPLE_GM(lineclosepath, canvas, 1240, 390) { 150 DEF_SIMPLE_GM(lineclosepath, canvas, 1240, 390) {
151 draw(canvas, true); 151 draw(canvas, true);
152 } 152 }
OLDNEW
« no previous file with comments | « gm/lightingshader2.cpp ('k') | gm/megalooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698