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

Unified Diff: gm/shadertext.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/samplerstress.cpp ('k') | gm/shadertext2.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/shadertext.cpp
diff --git a/gm/shadertext.cpp b/gm/shadertext.cpp
index f794481399b8c880146c2e19547495bdfc3f3236..7d54e77a9a26f72a9311274c4910282d8af06d56 100644
--- a/gm/shadertext.cpp
+++ b/gm/shadertext.cpp
@@ -37,11 +37,11 @@ struct GradData {
const SkScalar* fPos;
};
-static const SkColor gColors[] = {
+constexpr SkColor gColors[] = {
SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK
};
-static const GradData gGradData[] = {
+constexpr GradData gGradData[] = {
{ 2, gColors, nullptr },
{ 5, gColors, nullptr },
};
@@ -79,7 +79,7 @@ static sk_sp<SkShader> Make2Conical(const SkPoint pts[2], const GradData& data,
typedef sk_sp<SkShader> (*GradMaker)(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm);
-static const GradMaker gGradMakers[] = {
+constexpr GradMaker gGradMakers[] = {
MakeLinear, MakeRadial, MakeSweep, Make2Conical
};
@@ -119,9 +119,9 @@ protected:
SkShader::kMirror_TileMode
};
- static const int gradCount = SK_ARRAY_COUNT(gGradData) *
+ constexpr int gradCount = SK_ARRAY_COUNT(gGradData) *
SK_ARRAY_COUNT(gGradMakers);
- static const int bmpCount = SK_ARRAY_COUNT(tileModes) *
+ constexpr int bmpCount = SK_ARRAY_COUNT(tileModes) *
SK_ARRAY_COUNT(tileModes);
sk_sp<SkShader> shaders[gradCount + bmpCount];
@@ -158,9 +158,9 @@ protected:
false);
path.close();
- static const int testsPerCol = 8;
- static const int rowHeight = 60;
- static const int colWidth = 300;
+ constexpr int testsPerCol = 8;
+ constexpr int rowHeight = 60;
+ constexpr int colWidth = 300;
canvas->save();
for (int s = 0; s < static_cast<int>(SK_ARRAY_COUNT(shaders)); s++) {
canvas->save();
« no previous file with comments | « gm/samplerstress.cpp ('k') | gm/shadertext2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698