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 | 8 |
9 #include "gm.h" | 9 #include "gm.h" |
10 #include "SkPathEffect.h" | 10 #include "SkPathEffect.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); | 63 this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); |
64 } | 64 } |
65 | 65 |
66 void onOnceBeforeDraw() override { | 66 void onOnceBeforeDraw() override { |
67 // Create a light set consisting of | 67 // Create a light set consisting of |
68 // - bluish directional light pointing more right than down | 68 // - bluish directional light pointing more right than down |
69 // - reddish directional light pointing more down than right | 69 // - reddish directional light pointing more down than right |
70 // - soft white ambient light | 70 // - soft white ambient light |
71 | 71 |
72 SkLights::Builder builder; | 72 SkLights::Builder builder; |
73 builder.add(SkLights::Light(SkColor3f::Make(0.2f, 0.3f, 0.4f), | 73 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(0.2f, 0.3f,
0.4f), |
74 SkVector3::Make(0.2f, 0.1f, 1.0f))); | 74 SkVector3::Make(0.2f, 0.1f,
1.0f))); |
75 builder.add(SkLights::Light(SkColor3f::Make(0.4f, 0.3f, 0.2f), | 75 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(0.4f, 0.3f,
0.2f), |
76 SkVector3::Make(0.1f, 0.2f, 1.0f))); | 76 SkVector3::Make(0.1f, 0.2f,
1.0f))); |
77 builder.add(SkLights::Light(SkColor3f::Make(0.4f, 0.4f, 0.4f))); | 77 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.4f, 0.4f, 0.4
f))); |
78 fLights = builder.finish(); | 78 fLights = builder.finish(); |
79 } | 79 } |
80 | 80 |
81 protected: | 81 protected: |
82 static const int kWidth = 400; | 82 static const int kWidth = 400; |
83 static const int kHeight = 400; | 83 static const int kHeight = 400; |
84 | 84 |
85 SkString onShortName() override { | 85 SkString onShortName() override { |
86 return SkString("shadowmaps"); | 86 return SkString("shadowmaps"); |
87 } | 87 } |
(...skipping 14 matching lines...) Expand all Loading... |
102 sk_sp<SkLights> fLights; | 102 sk_sp<SkLights> fLights; |
103 typedef GM INHERITED; | 103 typedef GM INHERITED; |
104 }; | 104 }; |
105 | 105 |
106 ////////////////////////////////////////////////////////////////////////////// | 106 ////////////////////////////////////////////////////////////////////////////// |
107 | 107 |
108 DEF_GM(return new ShadowMapsGM;) | 108 DEF_GM(return new ShadowMapsGM;) |
109 } | 109 } |
110 | 110 |
111 #endif | 111 #endif |
OLD | NEW |