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

Side by Side Diff: gm/blurquickreject.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/blurcircles2.cpp ('k') | gm/blurrect.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 "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 13 matching lines...) Expand all
24 protected: 24 protected:
25 SkString onShortName() override { 25 SkString onShortName() override {
26 return SkString("blurquickreject"); 26 return SkString("blurquickreject");
27 } 27 }
28 28
29 SkISize onISize() override { 29 SkISize onISize() override {
30 return SkISize::Make(kWidth, kHeight); 30 return SkISize::Make(kWidth, kHeight);
31 } 31 }
32 32
33 void onDraw(SkCanvas* canvas) override { 33 void onDraw(SkCanvas* canvas) override {
34 static const SkScalar kBlurRadius = SkIntToScalar(20); 34 constexpr SkScalar kBlurRadius = SkIntToScalar(20);
35 static const SkScalar kBoxSize = SkIntToScalar(100); 35 constexpr SkScalar kBoxSize = SkIntToScalar(100);
36 36
37 SkRect clipRect = SkRect::MakeXYWH(0, 0, kBoxSize, kBoxSize); 37 SkRect clipRect = SkRect::MakeXYWH(0, 0, kBoxSize, kBoxSize);
38 SkRect blurRects[] = { 38 SkRect blurRects[] = {
39 { -kBoxSize - (kBlurRadius+1), 0, -(kBlurRadius+1), kBoxSize }, 39 { -kBoxSize - (kBlurRadius+1), 0, -(kBlurRadius+1), kBoxSize },
40 { 0, -kBoxSize - (kBlurRadius+1), kBoxSize, -(kBlurRadius+1) }, 40 { 0, -kBoxSize - (kBlurRadius+1), kBoxSize, -(kBlurRadius+1) },
41 { kBoxSize+kBlurRadius+1, 0, 2*kBoxSize+kBlurRadius+1, kBoxSize }, 41 { kBoxSize+kBlurRadius+1, 0, 2*kBoxSize+kBlurRadius+1, kBoxSize },
42 { 0, kBoxSize+kBlurRadius+1, kBoxSize, 2*kBoxSize+kBlurRadius+1 } 42 { 0, kBoxSize+kBlurRadius+1, kBoxSize, 2*kBoxSize+kBlurRadius+1 }
43 }; 43 };
44 SkColor colors[] = { 44 SkColor colors[] = {
45 SK_ColorRED, 45 SK_ColorRED,
(...skipping 20 matching lines...) Expand all
66 canvas->clipRect(clipRect); 66 canvas->clipRect(clipRect);
67 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRects); ++i) { 67 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRects); ++i) {
68 blurPaint.setColor(colors[i]); 68 blurPaint.setColor(colors[i]);
69 canvas->drawRect(blurRects[i], blurPaint); 69 canvas->drawRect(blurRects[i], blurPaint);
70 canvas->drawRect(blurRects[i], hairlinePaint); 70 canvas->drawRect(blurRects[i], hairlinePaint);
71 } 71 }
72 canvas->restore(); 72 canvas->restore();
73 } 73 }
74 74
75 private: 75 private:
76 static const int kWidth = 300; 76 static constexpr int kWidth = 300;
77 static const int kHeight = 300; 77 static constexpr int kHeight = 300;
78 78
79 typedef GM INHERITED; 79 typedef GM INHERITED;
80 }; 80 };
81 81
82 DEF_GM( return new BlurQuickRejectGM(); ) 82 DEF_GM( return new BlurQuickRejectGM(); )
OLDNEW
« no previous file with comments | « gm/blurcircles2.cpp ('k') | gm/blurrect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698