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

Unified Diff: gm/imagetoyuvplanes.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/imagesource2.cpp ('k') | gm/inversepaths.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagetoyuvplanes.cpp
diff --git a/gm/imagetoyuvplanes.cpp b/gm/imagetoyuvplanes.cpp
index 63d3fa92dafe8cfe1051e2757c9d9000197e19ad..d08257295a5e25d4ec5681920d522d631802c052 100644
--- a/gm/imagetoyuvplanes.cpp
+++ b/gm/imagetoyuvplanes.cpp
@@ -25,7 +25,7 @@ static sk_sp<SkImage> create_image(GrContext* context, int width, int height) {
}
// Create an RGB image from which we will extract planes
SkPaint paint;
- static const SkColor kColors[] =
+ constexpr SkColor kColors[] =
{ SK_ColorBLUE, SK_ColorYELLOW, SK_ColorGREEN, SK_ColorWHITE };
SkScalar r = (width + height) / 4.f;
paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(0,0), r, kColors,
@@ -37,8 +37,8 @@ static sk_sp<SkImage> create_image(GrContext* context, int width, int height) {
}
DEF_SIMPLE_GM(image_to_yuv_planes, canvas, 120, 525) {
- static const SkScalar kPad = 5.f;
- static const int kImageSize = 32;
+ constexpr SkScalar kPad = 5.f;
+ constexpr int kImageSize = 32;
GrContext *context = canvas->getGrContext();
sk_sp<SkImage> rgbImage(create_image(context, kImageSize, kImageSize));
@@ -49,14 +49,14 @@ DEF_SIMPLE_GM(image_to_yuv_planes, canvas, 120, 525) {
canvas->drawImage(rgbImage.get(), kPad, kPad);
// Test cases where all three planes are the same size, where just u and v are the same size,
// and where all differ.
- static const SkISize kSizes[][3] = {
+ constexpr SkISize kSizes[][3] = {
{{kImageSize, kImageSize}, {kImageSize , kImageSize }, {kImageSize, kImageSize }},
{{kImageSize, kImageSize}, {kImageSize/2, kImageSize/2}, {kImageSize/2, kImageSize/2}},
{{kImageSize, kImageSize}, {kImageSize/2, kImageSize/2}, {kImageSize/3, kImageSize/3}}
};
// A mix of rowbytes triples to go with the above sizes.
- static const size_t kRowBytes[][3] {
+ constexpr size_t kRowBytes[][3] {
{0, 0, 0},
{kImageSize, kImageSize/2 + 1, kImageSize},
{kImageSize + 13, kImageSize, kImageSize/3 + 8}
« no previous file with comments | « gm/imagesource2.cpp ('k') | gm/inversepaths.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698