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

Unified Diff: gm/dashing.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/dashcircle.cpp ('k') | gm/dcshader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/dashing.cpp
diff --git a/gm/dashing.cpp b/gm/dashing.cpp
index 82e6eb35bfb46b1ea5e2fdedd8783bb66a1f2cdb..e23c24ed3b0d0cb3f8da46d3f0433f262ac463fd 100644
--- a/gm/dashing.cpp
+++ b/gm/dashing.cpp
@@ -57,7 +57,7 @@ protected:
SkISize onISize() { return SkISize::Make(640, 340); }
virtual void onDraw(SkCanvas* canvas) {
- static const struct {
+ constexpr struct {
int fOnInterval;
int fOffInterval;
} gData[] = {
@@ -145,7 +145,7 @@ protected:
SkISize onISize() { return SkISize::Make(640, 480); }
virtual void onDraw(SkCanvas* canvas) {
- static const int gIntervals[] = {
+ constexpr int gIntervals[] = {
3, // 3 dashes: each count [0] followed by intervals [1..count]
2, 10, 10,
4, 20, 5, 5, 5,
@@ -334,7 +334,7 @@ protected:
SkISize onISize() { return SkISize::Make(640, 950); }
virtual void onDraw(SkCanvas* canvas) {
- static const struct {
+ constexpr struct {
int fOnInterval;
int fOffInterval;
} gData[] = {
@@ -420,11 +420,11 @@ protected:
SkISize onISize() override { return SkISize::Make(400, 200); }
void onDraw(SkCanvas* canvas) override {
- static const int kOn = 4;
- static const int kOff = 4;
- static const int kIntervalLength = kOn + kOff;
+ constexpr int kOn = 4;
+ constexpr int kOff = 4;
+ constexpr int kIntervalLength = kOn + kOff;
- static const SkColor gColors[kIntervalLength] = {
+ constexpr SkColor gColors[kIntervalLength] = {
SK_ColorRED,
SK_ColorGREEN,
SK_ColorBLUE,
« no previous file with comments | « gm/dashcircle.cpp ('k') | gm/dcshader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698