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

Side by Side Diff: gm/yuvtorgbeffect.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/xfermodes3.cpp ('k') | no next file » | 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 2014 Google Inc. 2 * Copyright 2014 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 // This test only works with the GPU backend. 8 // This test only works with the GPU backend.
9 9
10 #include "gm.h" 10 #include "gm.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 GrTextureParams::ClampBilerp() , 87 GrTextureParams::ClampBilerp() ,
88 SkSourceGammaTreatment::kRespe ct)); 88 SkSourceGammaTreatment::kRespe ct));
89 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], 89 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2],
90 GrTextureParams::ClampBilerp() , 90 GrTextureParams::ClampBilerp() ,
91 SkSourceGammaTreatment::kRespe ct)); 91 SkSourceGammaTreatment::kRespe ct));
92 92
93 if (!texture[0] || !texture[1] || !texture[2]) { 93 if (!texture[0] || !texture[1] || !texture[2]) {
94 return; 94 return;
95 } 95 }
96 96
97 static const SkScalar kDrawPad = 10.f; 97 constexpr SkScalar kDrawPad = 10.f;
98 static const SkScalar kTestPad = 10.f; 98 constexpr SkScalar kTestPad = 10.f;
99 static const SkScalar kColorSpaceOffset = 36.f; 99 constexpr SkScalar kColorSpaceOffset = 36.f;
100 SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}}; 100 SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}};
101 101
102 for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpa ce; 102 for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpa ce;
103 ++space) { 103 ++space) {
104 SkRect renderRect = SkRect::MakeWH(SkIntToScalar(fBmp[0].width()), 104 SkRect renderRect = SkRect::MakeWH(SkIntToScalar(fBmp[0].width()),
105 SkIntToScalar(fBmp[0].height())); 105 SkIntToScalar(fBmp[0].height()));
106 renderRect.outset(kDrawPad, kDrawPad); 106 renderRect.outset(kDrawPad, kDrawPad);
107 107
108 SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset; 108 SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset;
109 SkScalar x = kDrawPad + kTestPad; 109 SkScalar x = kDrawPad + kTestPad;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 SkSourceGammaTreatment::kRespe ct)); 204 SkSourceGammaTreatment::kRespe ct));
205 texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], GrTexturePar ams::ClampBilerp(), 205 texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], GrTexturePar ams::ClampBilerp(),
206 SkSourceGammaTreatment::kRespe ct)); 206 SkSourceGammaTreatment::kRespe ct));
207 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[1], GrTexturePar ams::ClampBilerp(), 207 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[1], GrTexturePar ams::ClampBilerp(),
208 SkSourceGammaTreatment::kRespe ct)); 208 SkSourceGammaTreatment::kRespe ct));
209 209
210 if (!texture[0] || !texture[1] || !texture[2]) { 210 if (!texture[0] || !texture[1] || !texture[2]) {
211 return; 211 return;
212 } 212 }
213 213
214 static const SkScalar kDrawPad = 10.f; 214 constexpr SkScalar kDrawPad = 10.f;
215 static const SkScalar kTestPad = 10.f; 215 constexpr SkScalar kTestPad = 10.f;
216 static const SkScalar kColorSpaceOffset = 36.f; 216 constexpr SkScalar kColorSpaceOffset = 36.f;
217 SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}}; 217 SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}};
218 218
219 for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpa ce; ++space) { 219 for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpa ce; ++space) {
220 SkRect renderRect = 220 SkRect renderRect =
221 SkRect::MakeWH(SkIntToScalar(fBmp[0].width()), SkIntToScalar(fBm p[0].height())); 221 SkRect::MakeWH(SkIntToScalar(fBmp[0].width()), SkIntToScalar(fBm p[0].height()));
222 renderRect.outset(kDrawPad, kDrawPad); 222 renderRect.outset(kDrawPad, kDrawPad);
223 223
224 SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset; 224 SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset;
225 SkScalar x = kDrawPad + kTestPad; 225 SkScalar x = kDrawPad + kTestPad;
226 226
(...skipping 16 matching lines...) Expand all
243 private: 243 private:
244 SkBitmap fBmp[2]; 244 SkBitmap fBmp[2];
245 245
246 typedef GM INHERITED; 246 typedef GM INHERITED;
247 }; 247 };
248 248
249 DEF_GM(return new YUVNV12toRGBEffect;) 249 DEF_GM(return new YUVNV12toRGBEffect;)
250 } 250 }
251 251
252 #endif 252 #endif
OLDNEW
« no previous file with comments | « gm/xfermodes3.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698