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

Side by Side Diff: gm/lightingshader.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/lighting.cpp ('k') | gm/lightingshader2.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 2015 Google Inc. 2 * Copyright 2015 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 #include "gm.h" 8 #include "gm.h"
9 #include "SkLightingShader.h" 9 #include "SkLightingShader.h"
10 #include "SkNormalSource.h" 10 #include "SkNormalSource.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 protected: 60 protected:
61 enum NormalMap { 61 enum NormalMap {
62 kHemi_NormalMap, 62 kHemi_NormalMap,
63 kFrustum_NormalMap, 63 kFrustum_NormalMap,
64 kTetra_NormalMap, 64 kTetra_NormalMap,
65 65
66 kLast_NormalMap = kTetra_NormalMap 66 kLast_NormalMap = kTetra_NormalMap
67 }; 67 };
68 68
69 static const int kNormalMapCount = kLast_NormalMap+1; 69 static constexpr int kNormalMapCount = kLast_NormalMap+1;
70 70
71 SkString onShortName() override { 71 SkString onShortName() override {
72 return SkString("lightingshader"); 72 return SkString("lightingshader");
73 } 73 }
74 74
75 SkISize onISize() override { 75 SkISize onISize() override {
76 return SkISize::Make(kGMSize, kGMSize); 76 return SkISize::Make(kGMSize, kGMSize);
77 } 77 }
78 78
79 void onOnceBeforeDraw() override { 79 void onOnceBeforeDraw() override {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 canvas->save(); 157 canvas->save();
158 m.setRotate(45.0f, r.centerX(), r.centerY()); 158 m.setRotate(45.0f, r.centerX(), r.centerY());
159 m.postTranslate(0.0f, -kGMSize/2.0f + kTexSize/2.0f); 159 m.postTranslate(0.0f, -kGMSize/2.0f + kTexSize/2.0f);
160 canvas->setMatrix(m); 160 canvas->setMatrix(m);
161 this->drawRect(canvas, r, kHemi_NormalMap); 161 this->drawRect(canvas, r, kHemi_NormalMap);
162 canvas->restore(); 162 canvas->restore();
163 } 163 }
164 } 164 }
165 165
166 private: 166 private:
167 static const int kTexSize = 128; 167 static constexpr int kTexSize = 128;
168 static const int kGMSize = 512; 168 static constexpr int kGMSize = 512;
169 169
170 SkBitmap fDiffuse; 170 SkBitmap fDiffuse;
171 SkBitmap fNormalMaps[kNormalMapCount]; 171 SkBitmap fNormalMaps[kNormalMapCount];
172 172
173 sk_sp<SkLights> fLights; 173 sk_sp<SkLights> fLights;
174 174
175 typedef GM INHERITED; 175 typedef GM INHERITED;
176 }; 176 };
177 177
178 ////////////////////////////////////////////////////////////////////////////// 178 //////////////////////////////////////////////////////////////////////////////
179 179
180 DEF_GM(return new LightingShaderGM;) 180 DEF_GM(return new LightingShaderGM;)
181 } 181 }
OLDNEW
« no previous file with comments | « gm/lighting.cpp ('k') | gm/lightingshader2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698