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/aarectmodes.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 | « no previous file | gm/aaxfermodes.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 "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 default: 51 default:
52 SkASSERT(false); 52 SkASSERT(false);
53 break; 53 break;
54 } 54 }
55 } 55 }
56 SkRect clip = {0, 130, 772, 531}; 56 SkRect clip = {0, 130, 772, 531};
57 canvas->clipRect(clip); 57 canvas->clipRect(clip);
58 canvas->drawPath(path, paint); 58 canvas->drawPath(path, paint);
59 } 59 }
60 60
61 static const struct { 61 constexpr struct {
62 SkXfermode::Mode fMode; 62 SkXfermode::Mode fMode;
63 const char* fLabel; 63 const char* fLabel;
64 } gModes[] = { 64 } gModes[] = {
65 { SkXfermode::kClear_Mode, "Clear" }, 65 { SkXfermode::kClear_Mode, "Clear" },
66 { SkXfermode::kSrc_Mode, "Src" }, 66 { SkXfermode::kSrc_Mode, "Src" },
67 { SkXfermode::kDst_Mode, "Dst" }, 67 { SkXfermode::kDst_Mode, "Dst" },
68 { SkXfermode::kSrcOver_Mode, "SrcOver" }, 68 { SkXfermode::kSrcOver_Mode, "SrcOver" },
69 { SkXfermode::kDstOver_Mode, "DstOver" }, 69 { SkXfermode::kDstOver_Mode, "DstOver" },
70 { SkXfermode::kSrcIn_Mode, "SrcIn" }, 70 { SkXfermode::kSrcIn_Mode, "SrcIn" },
71 { SkXfermode::kDstIn_Mode, "DstIn" }, 71 { SkXfermode::kDstIn_Mode, "DstIn" },
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return SkString("aarectmodes"); 133 return SkString("aarectmodes");
134 } 134 }
135 135
136 SkISize onISize() override { return SkISize::Make(640, 480); } 136 SkISize onISize() override { return SkISize::Make(640, 480); }
137 137
138 void onDraw(SkCanvas* canvas) override { 138 void onDraw(SkCanvas* canvas) override {
139 if (false) { // avoid bit rot, suppress warning 139 if (false) { // avoid bit rot, suppress warning
140 test4(canvas); 140 test4(canvas);
141 } 141 }
142 const SkRect bounds = SkRect::MakeWH(W, H); 142 const SkRect bounds = SkRect::MakeWH(W, H);
143 static const SkAlpha gAlphaValue[] = { 0xFF, 0x88, 0x88 }; 143 constexpr SkAlpha gAlphaValue[] = { 0xFF, 0x88, 0x88 };
144 144
145 canvas->translate(SkIntToScalar(4), SkIntToScalar(4)); 145 canvas->translate(SkIntToScalar(4), SkIntToScalar(4));
146 146
147 for (int alpha = 0; alpha < 4; ++alpha) { 147 for (int alpha = 0; alpha < 4; ++alpha) {
148 canvas->save(); 148 canvas->save();
149 canvas->save(); 149 canvas->save();
150 for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); ++i) { 150 for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); ++i) {
151 if (6 == i) { 151 if (6 == i) {
152 canvas->restore(); 152 canvas->restore();
153 canvas->translate(W * 5, 0); 153 canvas->translate(W * 5, 0);
(...skipping 17 matching lines...) Expand all
171 private: 171 private:
172 typedef GM INHERITED; 172 typedef GM INHERITED;
173 }; 173 };
174 174
175 ////////////////////////////////////////////////////////////////////////////// 175 //////////////////////////////////////////////////////////////////////////////
176 176
177 static GM* MyFactory(void*) { return new AARectModesGM; } 177 static GM* MyFactory(void*) { return new AARectModesGM; }
178 static GMRegistry reg(MyFactory); 178 static GMRegistry reg(MyFactory);
179 179
180 } 180 }
OLDNEW
« no previous file with comments | « no previous file | gm/aaxfermodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698