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

Unified Diff: gm/gradients_no_texture.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/gradients_2pt_conical.cpp ('k') | gm/hairlines.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gradients_no_texture.cpp
diff --git a/gm/gradients_no_texture.cpp b/gm/gradients_no_texture.cpp
index b688aab4cb5c326158e4763191dd9e24db499b09..5d0d4c920207ecfd13951f1eb5e2f9903d7db247 100644
--- a/gm/gradients_no_texture.cpp
+++ b/gm/gradients_no_texture.cpp
@@ -15,11 +15,11 @@ struct GradData {
const SkScalar* fPos;
};
-static const SkColor gColors[] = {
+constexpr SkColor gColors[] = {
SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE,
};
-static const GradData gGradData[] = {
+constexpr GradData gGradData[] = {
{ 1, gColors, nullptr },
{ 2, gColors, nullptr },
{ 3, gColors, nullptr },
@@ -71,7 +71,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, Make2Radial, Make2Conical,
};
@@ -92,16 +92,16 @@ protected:
SkISize onISize() override { return SkISize::Make(640, 615); }
void onDraw(SkCanvas* canvas) override {
- static const SkPoint kPts[2] = { { 0, 0 },
+ constexpr SkPoint kPts[2] = { { 0, 0 },
{ SkIntToScalar(50), SkIntToScalar(50) } };
- static const SkShader::TileMode kTM = SkShader::kClamp_TileMode;
+ constexpr SkShader::TileMode kTM = SkShader::kClamp_TileMode;
SkRect kRect = { 0, 0, SkIntToScalar(50), SkIntToScalar(50) };
SkPaint paint;
paint.setAntiAlias(true);
paint.setDither(fDither);
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
- static const uint8_t kAlphas[] = { 0xff, 0x40 };
+ constexpr uint8_t kAlphas[] = { 0xff, 0x40 };
for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphas); ++a) {
for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); ++i) {
canvas->save();
« no previous file with comments | « gm/gradients_2pt_conical.cpp ('k') | gm/hairlines.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698