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

Side by Side Diff: gm/hairmodes.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/hairlines.cpp ('k') | gm/image.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"
11 #include "SkShader.h" 11 #include "SkShader.h"
12 12
13 static const struct { 13 constexpr struct {
14 SkXfermode::Mode fMode; 14 SkXfermode::Mode fMode;
15 const char* fLabel; 15 const char* fLabel;
16 } gModes[] = { 16 } gModes[] = {
17 { SkXfermode::kClear_Mode, "Clear" }, 17 { SkXfermode::kClear_Mode, "Clear" },
18 { SkXfermode::kSrc_Mode, "Src" }, 18 { SkXfermode::kSrc_Mode, "Src" },
19 { SkXfermode::kDst_Mode, "Dst" }, 19 { SkXfermode::kDst_Mode, "Dst" },
20 { SkXfermode::kSrcOver_Mode, "SrcOver" }, 20 { SkXfermode::kSrcOver_Mode, "SrcOver" },
21 { SkXfermode::kDstOver_Mode, "DstOver" }, 21 { SkXfermode::kDstOver_Mode, "DstOver" },
22 { SkXfermode::kSrcIn_Mode, "SrcIn" }, 22 { SkXfermode::kSrcIn_Mode, "SrcIn" },
23 { SkXfermode::kDstIn_Mode, "DstIn" }, 23 { SkXfermode::kDstIn_Mode, "DstIn" },
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 virtual SkISize onISize() override { return SkISize::Make(640, 480); } 83 virtual SkISize onISize() override { return SkISize::Make(640, 480); }
84 84
85 void onOnceBeforeDraw() override { 85 void onOnceBeforeDraw() override {
86 fBGPaint.setShader(make_bg_shader()); 86 fBGPaint.setShader(make_bg_shader());
87 } 87 }
88 88
89 void onDraw(SkCanvas* canvas) override { 89 void onDraw(SkCanvas* canvas) override {
90 const SkRect bounds = SkRect::MakeWH(W, H); 90 const SkRect bounds = SkRect::MakeWH(W, H);
91 static const SkAlpha gAlphaValue[] = { 0xFF, 0x88, 0x88 }; 91 constexpr SkAlpha gAlphaValue[] = { 0xFF, 0x88, 0x88 };
92 92
93 canvas->translate(SkIntToScalar(4), SkIntToScalar(4)); 93 canvas->translate(SkIntToScalar(4), SkIntToScalar(4));
94 94
95 for (int alpha = 0; alpha < 4; ++alpha) { 95 for (int alpha = 0; alpha < 4; ++alpha) {
96 canvas->save(); 96 canvas->save();
97 canvas->save(); 97 canvas->save();
98 for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); ++i) { 98 for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); ++i) {
99 if (6 == i) { 99 if (6 == i) {
100 canvas->restore(); 100 canvas->restore();
101 canvas->translate(W * 5, 0); 101 canvas->translate(W * 5, 0);
(...skipping 18 matching lines...) Expand all
120 private: 120 private:
121 typedef GM INHERITED; 121 typedef GM INHERITED;
122 }; 122 };
123 123
124 //////////////////////////////////////////////////////////////////////////// // 124 //////////////////////////////////////////////////////////////////////////// //
125 125
126 static GM* MyFactory(void*) { return new HairModesGM; } 126 static GM* MyFactory(void*) { return new HairModesGM; }
127 static GMRegistry reg(MyFactory); 127 static GMRegistry reg(MyFactory);
128 128
129 } 129 }
OLDNEW
« no previous file with comments | « gm/hairlines.cpp ('k') | gm/image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698