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 "SkPictureRecorder.h" | 9 #include "SkPictureRecorder.h" |
10 #include "SkShadowPaintFilterCanvas.h" | 10 #include "SkShadowPaintFilterCanvas.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 fPicture = this->makeTestPicture(kWidth, kHeight); | 109 fPicture = this->makeTestPicture(kWidth, kHeight); |
110 } | 110 } |
111 | 111 |
112 if (fSceneChanged || fLightsChanged || fClearShadowMaps) { | 112 if (fSceneChanged || fLightsChanged || fClearShadowMaps) { |
113 for (int i = 0; i < fLights->numLights(); i++) { | 113 for (int i = 0; i < fLights->numLights(); i++) { |
114 fLights->light(i).setShadowMap(nullptr); | 114 fLights->light(i).setShadowMap(nullptr); |
115 } | 115 } |
116 fSceneChanged = false; | 116 fSceneChanged = false; |
117 fLightsChanged = false; | 117 fLightsChanged = false; |
118 fClearShadowMaps = false; | 118 fClearShadowMaps = false; |
| 119 } |
119 | 120 |
120 canvas->setLights(fLights); | 121 canvas->setLights(fLights); |
121 canvas->drawShadowedPicture(fPicture, nullptr, nullptr); | 122 canvas->drawShadowedPicture(fPicture, nullptr, nullptr); |
122 } | |
123 } | 123 } |
124 | 124 |
125 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove
rride { | 125 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove
rride { |
126 return new SkView::Click(this); | 126 return new SkView::Click(this); |
127 } | 127 } |
128 | 128 |
129 bool onClick(Click *click) override { | 129 bool onClick(Click *click) override { |
130 SkScalar x = click->fCurr.fX; | 130 SkScalar x = click->fCurr.fX; |
131 SkScalar y = click->fCurr.fY; | 131 SkScalar y = click->fCurr.fY; |
132 | 132 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 sk_sp<SkLights> fLights; | 211 sk_sp<SkLights> fLights; |
212 | 212 |
213 typedef SampleView INHERITED; | 213 typedef SampleView INHERITED; |
214 }; | 214 }; |
215 | 215 |
216 ////////////////////////////////////////////////////////////////////////////// | 216 ////////////////////////////////////////////////////////////////////////////// |
217 static SkView* MyFactory() { return new ShadowingView; } | 217 static SkView* MyFactory() { return new ShadowingView; } |
218 static SkViewRegister reg(MyFactory); | 218 static SkViewRegister reg(MyFactory); |
219 | 219 |
220 #endif | 220 #endif |
OLD | NEW |