OLD | NEW |
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 "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 namespace skiagm { | 100 namespace skiagm { |
101 | 101 |
102 // This GM exercises lighting shaders. | 102 // This GM exercises lighting shaders. |
103 class LightingShaderGM : public GM { | 103 class LightingShaderGM : public GM { |
104 public: | 104 public: |
105 LightingShaderGM() { | 105 LightingShaderGM() { |
106 this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); | 106 this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); |
107 | 107 |
108 fLight.fColor = SkColorSetRGB(0xff, 0xff, 0xff); | 108 fLight.fColor = SkColor3f::Make(1.0f, 1.0f, 1.0f); |
109 fLight.fDirection.fX = 0.0f; | 109 fLight.fDirection.fX = 0.0f; |
110 fLight.fDirection.fY = 0.0f; | 110 fLight.fDirection.fY = 0.0f; |
111 fLight.fDirection.fZ = 1.0f; | 111 fLight.fDirection.fZ = 1.0f; |
112 | 112 |
113 fAmbient = SkColorSetRGB(0x1f, 0x1f, 0x1f); | 113 fAmbient = SkColor3f::Make(0.1f, 0.1f, 0.1f); |
114 } | 114 } |
115 | 115 |
116 protected: | 116 protected: |
117 | 117 |
118 SkString onShortName() override { | 118 SkString onShortName() override { |
119 return SkString("lightingshader"); | 119 return SkString("lightingshader"); |
120 } | 120 } |
121 | 121 |
122 SkISize onISize() override { | 122 SkISize onISize() override { |
123 return SkISize::Make(kGMSize, kGMSize); | 123 return SkISize::Make(kGMSize, kGMSize); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 private: | 165 private: |
166 static const int kTexSize = 128; | 166 static const int kTexSize = 128; |
167 static const int kGMSize = 512; | 167 static const int kGMSize = 512; |
168 | 168 |
169 SkBitmap fDiffuse; | 169 SkBitmap fDiffuse; |
170 SkBitmap fHemiNormalMap; | 170 SkBitmap fHemiNormalMap; |
171 SkBitmap fFrustumNormalMap; | 171 SkBitmap fFrustumNormalMap; |
172 | 172 |
173 SkLightingShader::Light fLight; | 173 SkLightingShader::Light fLight; |
174 SkColor fAmbient; | 174 SkColor3f fAmbient; |
175 | 175 |
176 typedef GM INHERITED; | 176 typedef GM INHERITED; |
177 }; | 177 }; |
178 | 178 |
179 ////////////////////////////////////////////////////////////////////////////// | 179 ////////////////////////////////////////////////////////////////////////////// |
180 | 180 |
181 DEF_GM( return SkNEW(LightingShaderGM); ) | 181 DEF_GM( return SkNEW(LightingShaderGM); ) |
182 | 182 |
183 } | 183 } |
OLD | NEW |