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

Side by Side Diff: gm/texdata.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/tallstretchedbitmaps.cpp ('k') | gm/textblobblockreordering.cpp » ('j') | 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 2011 Google Inc. 2 * Copyright 2011 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"
11 11
12 #if SK_SUPPORT_GPU 12 #if SK_SUPPORT_GPU
13 #include "GrContext.h" 13 #include "GrContext.h"
14 #include "GrDrawContext.h" 14 #include "GrDrawContext.h"
15 #include "GrFixedClip.h" 15 #include "GrFixedClip.h"
16 #include "SkColorPriv.h" 16 #include "SkColorPriv.h"
17 #include "effects/GrPorterDuffXferProcessor.h" 17 #include "effects/GrPorterDuffXferProcessor.h"
18 #include "effects/GrSimpleTextureEffect.h" 18 #include "effects/GrSimpleTextureEffect.h"
19 19
20 static const int S = 200; 20 constexpr int S = 200;
21 21
22 DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) { 22 DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) {
23 GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawCont ext(); 23 GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawCont ext();
24 if (!drawContext) { 24 if (!drawContext) {
25 skiagm::GM::DrawGpuOnlyMessage(canvas); 25 skiagm::GM::DrawGpuOnlyMessage(canvas);
26 return; 26 return;
27 } 27 }
28 28
29 GrContext* context = canvas->getGrContext(); 29 GrContext* context = canvas->getGrContext();
30 if (!context) { 30 if (!context) {
31 return; 31 return;
32 } 32 }
33 33
34 SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S)); 34 SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S));
35 static const int stride = 2 * S; 35 constexpr int stride = 2 * S;
36 static const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40); 36 const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40);
37 static const SkPMColor white = SkPackARGB32(0xff, 0xff, 0xff, 0xff); 37 const SkPMColor white = SkPackARGB32(0xff, 0xff, 0xff, 0xff);
38 static const SkPMColor red = SkPackARGB32(0x80, 0x80, 0x00, 0x00); 38 const SkPMColor red = SkPackARGB32(0x80, 0x80, 0x00, 0x00);
39 static const SkPMColor blue = SkPackARGB32(0x80, 0x00, 0x00, 0x80); 39 const SkPMColor blue = SkPackARGB32(0x80, 0x00, 0x00, 0x80);
40 static const SkPMColor green = SkPackARGB32(0x80, 0x00, 0x80, 0x00); 40 const SkPMColor green = SkPackARGB32(0x80, 0x00, 0x80, 0x00);
41 static const SkPMColor black = SkPackARGB32(0x00, 0x00, 0x00, 0x00); 41 const SkPMColor black = SkPackARGB32(0x00, 0x00, 0x00, 0x00);
42 for (int i = 0; i < 2; ++i) { 42 for (int i = 0; i < 2; ++i) {
43 int offset = 0; 43 int offset = 0;
44 // fill upper-left 44 // fill upper-left
45 for (int y = 0; y < S; ++y) { 45 for (int y = 0; y < S; ++y) {
46 for (int x = 0; x < S; ++x) { 46 for (int x = 0; x < S; ++x) {
47 gTextureData[offset + y * stride + x] = gray; 47 gTextureData[offset + y * stride + x] = gray;
48 } 48 }
49 } 49 }
50 // fill upper-right 50 // fill upper-right
51 offset = S; 51 offset = S;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 } 114 }
115 texture->writePixels(S, (i ? 0 : S), S, S, 115 texture->writePixels(S, (i ? 0 : S), S, S,
116 texture->config(), gTextureData.get(), 116 texture->config(), gTextureData.get(),
117 4 * stride); 117 4 * stride);
118 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S)); 118 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S));
119 } 119 }
120 } 120 }
121 #endif 121 #endif
122 122
OLDNEW
« no previous file with comments | « gm/tallstretchedbitmaps.cpp ('k') | gm/textblobblockreordering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698