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

Side by Side Diff: gm/lightingshader.cpp

Issue 2026763002: Make use of new SkLights class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix SampleApp slide Created 4 years, 6 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 | « no previous file | gyp/core.gypi » ('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 9
10 #include "SkLightingShader.h" 10 #include "SkLightingShader.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 namespace skiagm { 41 namespace skiagm {
42 42
43 // This GM exercises lighting shaders. 43 // This GM exercises lighting shaders.
44 class LightingShaderGM : public GM { 44 class LightingShaderGM : public GM {
45 public: 45 public:
46 LightingShaderGM() { 46 LightingShaderGM() {
47 this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); 47 this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC));
48 48
49 SkLightingShader::Lights::Builder builder; 49 SkLights::Builder builder;
50 50
51 builder.add(SkLight(SkColor3f::Make(1.0f, 1.0f, 1.0f), 51 builder.add(SkLights::Light(SkColor3f::Make(1.0f, 1.0f, 1.0f),
52 SkVector3::Make(1.0f, 0.0f, 0.0f))); 52 SkVector3::Make(1.0f, 0.0f, 0.0f)));
53 builder.add(SkLight(SkColor3f::Make(0.2f, 0.2f, 0.2f))); 53 builder.add(SkLights::Light(SkColor3f::Make(0.2f, 0.2f, 0.2f)));
54 54
55 fLights.reset(builder.finish()); 55 fLights = builder.finish();
56 } 56 }
57 57
58 protected: 58 protected:
59 enum NormalMap { 59 enum NormalMap {
60 kHemi_NormalMap, 60 kHemi_NormalMap,
61 kFrustum_NormalMap, 61 kFrustum_NormalMap,
62 kTetra_NormalMap, 62 kTetra_NormalMap,
63 63
64 kLast_NormalMap = kTetra_NormalMap 64 kLast_NormalMap = kTetra_NormalMap
65 }; 65 };
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 canvas->setMatrix(m); 155 canvas->setMatrix(m);
156 this->drawRect(canvas, r, kHemi_NormalMap); 156 this->drawRect(canvas, r, kHemi_NormalMap);
157 canvas->restore(); 157 canvas->restore();
158 } 158 }
159 } 159 }
160 160
161 private: 161 private:
162 static const int kTexSize = 128; 162 static const int kTexSize = 128;
163 static const int kGMSize = 512; 163 static const int kGMSize = 512;
164 164
165 SkBitmap fDiffuse; 165 SkBitmap fDiffuse;
166 SkBitmap fNormalMaps[kNormalMapCount]; 166 SkBitmap fNormalMaps[kNormalMapCount];
167 167
168 SkAutoTUnref<const SkLightingShader::Lights> fLights; 168 sk_sp<SkLights> fLights;
169 169
170 typedef GM INHERITED; 170 typedef GM INHERITED;
171 }; 171 };
172 172
173 ////////////////////////////////////////////////////////////////////////////// 173 //////////////////////////////////////////////////////////////////////////////
174 174
175 DEF_GM(return new LightingShaderGM;) 175 DEF_GM(return new LightingShaderGM;)
176 } 176 }
OLDNEW
« no previous file with comments | « no previous file | gyp/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698