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

Side by Side Diff: gm/nonclosedpaths.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/nested.cpp ('k') | gm/occludedrrectblur.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 2013 Google Inc. 2 * Copyright 2013 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 static void SetLocation(SkCanvas* canvas, int counter, int lineNum) { 64 static void SetLocation(SkCanvas* canvas, int counter, int lineNum) {
65 SkScalar x = SK_Scalar1 * 100 * (counter % lineNum) + 10 + SK_Scalar1 / 4; 65 SkScalar x = SK_Scalar1 * 100 * (counter % lineNum) + 10 + SK_Scalar1 / 4;
66 SkScalar y = SK_Scalar1 * 100 * (counter / lineNum) + 10 + 3 * SK_Scalar 1 / 4; 66 SkScalar y = SK_Scalar1 * 100 * (counter / lineNum) + 10 + 3 * SK_Scalar 1 / 4;
67 canvas->translate(x, y); 67 canvas->translate(x, y);
68 } 68 }
69 69
70 void onDraw(SkCanvas* canvas) override { 70 void onDraw(SkCanvas* canvas) override {
71 // Stroke widths are: 71 // Stroke widths are:
72 // 0(may use hairline rendering), 10(common case for stroke-style) 72 // 0(may use hairline rendering), 10(common case for stroke-style)
73 // 40 and 50(>= geometry width/height, make the contour filled in fact) 73 // 40 and 50(>= geometry width/height, make the contour filled in fact)
74 static const int kStrokeWidth[] = {0, 10, 40, 50}; 74 constexpr int kStrokeWidth[] = {0, 10, 40, 50};
75 int numWidths = SK_ARRAY_COUNT(kStrokeWidth); 75 int numWidths = SK_ARRAY_COUNT(kStrokeWidth);
76 76
77 static const SkPaint::Style kStyle[] = { 77 constexpr SkPaint::Style kStyle[] = {
78 SkPaint::kStroke_Style, SkPaint::kStrokeAndFill_Style 78 SkPaint::kStroke_Style, SkPaint::kStrokeAndFill_Style
79 }; 79 };
80 80
81 static const SkPaint::Cap kCap[] = { 81 constexpr SkPaint::Cap kCap[] = {
82 SkPaint::kButt_Cap, SkPaint::kRound_Cap, SkPaint::kSquare_Cap 82 SkPaint::kButt_Cap, SkPaint::kRound_Cap, SkPaint::kSquare_Cap
83 }; 83 };
84 84
85 static const SkPaint::Join kJoin[] = { 85 constexpr SkPaint::Join kJoin[] = {
86 SkPaint::kMiter_Join, SkPaint::kRound_Join, SkPaint::kBevel_Join 86 SkPaint::kMiter_Join, SkPaint::kRound_Join, SkPaint::kBevel_Join
87 }; 87 };
88 88
89 static const ClosureType kType[] = { 89 constexpr ClosureType kType[] = {
90 TotallyNonClosed, FakeCloseCorner, FakeCloseMiddle 90 TotallyNonClosed, FakeCloseCorner, FakeCloseMiddle
91 }; 91 };
92 92
93 int counter = 0; 93 int counter = 0;
94 SkPaint paint; 94 SkPaint paint;
95 paint.setAntiAlias(true); 95 paint.setAntiAlias(true);
96 96
97 // For stroke style painter and fill-and-stroke style painter 97 // For stroke style painter and fill-and-stroke style painter
98 for (size_t type = 0; type < kClosureTypeCount; ++type) { 98 for (size_t type = 0; type < kClosureTypeCount; ++type) {
99 for (size_t style = 0; style < SK_ARRAY_COUNT(kStyle); ++style) { 99 for (size_t style = 0; style < SK_ARRAY_COUNT(kStyle); ++style) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 private: 138 private:
139 typedef GM INHERITED; 139 typedef GM INHERITED;
140 }; 140 };
141 141
142 ////////////////////////////////////////////////////////////////////////////// 142 //////////////////////////////////////////////////////////////////////////////
143 143
144 DEF_GM(return new NonClosedPathsGM;) 144 DEF_GM(return new NonClosedPathsGM;)
145 145
146 } 146 }
OLDNEW
« no previous file with comments | « gm/nested.cpp ('k') | gm/occludedrrectblur.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698