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 "gm.h" | 8 #include "gm.h" |
9 #include "SkLightingShader.h" | 9 #include "SkLightingShader.h" |
10 #include "SkNormalSource.h" | 10 #include "SkNormalSource.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 SkISize onISize() override { | 38 SkISize onISize() override { |
39 return SkISize::Make(600, 740); | 39 return SkISize::Make(600, 740); |
40 } | 40 } |
41 | 41 |
42 void onOnceBeforeDraw() override { | 42 void onOnceBeforeDraw() override { |
43 SkLights::Builder builder; | 43 SkLights::Builder builder; |
44 const SkVector3 kLightFromUpperRight = SkVector3::Make(0.788f, 0.394f, 0
.473f); | 44 const SkVector3 kLightFromUpperRight = SkVector3::Make(0.788f, 0.394f, 0
.473f); |
45 | 45 |
46 builder.add(SkLights::Light(SkColor3f::Make(1.0f, 1.0f, 1.0f), | 46 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f,
1.0f), |
47 kLightFromUpperRight)); | 47 kLightFromUpperRight)); |
48 builder.add(SkLights::Light(SkColor3f::Make(0.2f, 0.2f, 0.2f))); | 48 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.2f, 0.2f, 0.2
f))); |
49 fLights = builder.finish(); | 49 fLights = builder.finish(); |
50 | 50 |
51 fRect = SkRect::MakeIWH(kTexSize, kTexSize); | 51 fRect = SkRect::MakeIWH(kTexSize, kTexSize); |
52 SkMatrix matrix; | 52 SkMatrix matrix; |
53 SkRect bitmapBounds = SkRect::MakeIWH(kTexSize, kTexSize); | 53 SkRect bitmapBounds = SkRect::MakeIWH(kTexSize, kTexSize); |
54 matrix.setRectToRect(bitmapBounds, fRect, SkMatrix::kFill_ScaleToFit); | 54 matrix.setRectToRect(bitmapBounds, fRect, SkMatrix::kFill_ScaleToFit); |
55 | 55 |
56 SkBitmap opaqueDiffuseMap = sk_tool_utils::create_checkerboard_bitmap( | 56 SkBitmap opaqueDiffuseMap = sk_tool_utils::create_checkerboard_bitmap( |
57 kTexSize, kTexSize, | 57 kTexSize, kTexSize, |
58 sk_tool_utils::color_to_565(0x0), | 58 sk_tool_utils::color_to_565(0x0), |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 SkRect fRect; | 221 SkRect fRect; |
222 sk_sp<SkLights> fLights; | 222 sk_sp<SkLights> fLights; |
223 | 223 |
224 typedef GM INHERITED; | 224 typedef GM INHERITED; |
225 }; | 225 }; |
226 | 226 |
227 ////////////////////////////////////////////////////////////////////////////// | 227 ////////////////////////////////////////////////////////////////////////////// |
228 | 228 |
229 DEF_GM(return new LightingShader2GM;) | 229 DEF_GM(return new LightingShader2GM;) |
230 } | 230 } |
OLD | NEW |