OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkAnimTimer.h" | 9 #include "SkAnimTimer.h" |
10 #include "SkBitmapProcShader.h" | 10 #include "SkBitmapProcShader.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 kLast_ObjType = kShip_ObjType | 177 kLast_ObjType = kShip_ObjType |
178 }; | 178 }; |
179 | 179 |
180 static const int kObjTypeCount = kLast_ObjType + 1; | 180 static const int kObjTypeCount = kLast_ObjType + 1; |
181 | 181 |
182 void updateLights() { | 182 void updateLights() { |
183 SkLights::Builder builder; | 183 SkLights::Builder builder; |
184 | 184 |
185 builder.add(SkLights::Light::MakeDirectional( | 185 builder.add(SkLights::Light::MakeDirectional( |
186 SkColor3f::Make(1.0f, 1.0f, 1.0f), fLightDir)); | 186 SkColor3f::Make(1.0f, 1.0f, 1.0f), fLightDir)); |
187 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.2f, 0.2f, 0.2
f))); | 187 builder.setAmbientLightColor(SkColor3f::Make(0.2f, 0.2f, 0.2f)); |
188 | 188 |
189 fLights = builder.finish(); | 189 fLights = builder.finish(); |
190 } | 190 } |
191 | 191 |
192 #ifdef SK_DEBUG | 192 #ifdef SK_DEBUG |
193 // Draw a vector to the light | 193 // Draw a vector to the light |
194 void drawLightDir(SkCanvas* canvas, SkScalar centerX, SkScalar centerY) { | 194 void drawLightDir(SkCanvas* canvas, SkScalar centerX, SkScalar centerY) { |
195 static const int kBgLen = 30; | 195 static const int kBgLen = 30; |
196 static const int kSmLen = 5; | 196 static const int kSmLen = 5; |
197 | 197 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 private: | 508 private: |
509 SkAutoTUnref<DrawLitAtlasDrawable> fDrawable; | 509 SkAutoTUnref<DrawLitAtlasDrawable> fDrawable; |
510 | 510 |
511 typedef SampleView INHERITED; | 511 typedef SampleView INHERITED; |
512 }; | 512 }; |
513 | 513 |
514 ////////////////////////////////////////////////////////////////////////////// | 514 ////////////////////////////////////////////////////////////////////////////// |
515 | 515 |
516 static SkView* MyFactory() { return new DrawLitAtlasView; } | 516 static SkView* MyFactory() { return new DrawLitAtlasView; } |
517 static SkViewRegister reg(MyFactory); | 517 static SkViewRegister reg(MyFactory); |
OLD | NEW |