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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 void onDrawContent(SkCanvas *canvas) override { | 107 void onDrawContent(SkCanvas *canvas) override { |
108 if (fSceneChanged) { | 108 if (fSceneChanged) { |
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 |
116 fSceneChanged = false; | 117 fSceneChanged = false; |
117 fLightsChanged = false; | 118 fLightsChanged = false; |
118 fClearShadowMaps = false; | 119 fClearShadowMaps = false; |
| 120 } |
119 | 121 |
120 canvas->setLights(fLights); | 122 canvas->setLights(fLights); |
121 canvas->drawShadowedPicture(fPicture, nullptr, nullptr); | 123 canvas->drawShadowedPicture(fPicture, nullptr, nullptr); |
122 } | |
123 } | 124 } |
124 | 125 |
125 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove
rride { | 126 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove
rride { |
126 return new SkView::Click(this); | 127 return new SkView::Click(this); |
127 } | 128 } |
128 | 129 |
129 bool onClick(Click *click) override { | 130 bool onClick(Click *click) override { |
130 SkScalar x = click->fCurr.fX; | 131 SkScalar x = click->fCurr.fX; |
131 SkScalar y = click->fCurr.fY; | 132 SkScalar y = click->fCurr.fY; |
132 | 133 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 sk_sp<SkLights> fLights; | 209 sk_sp<SkLights> fLights; |
209 | 210 |
210 typedef SampleView INHERITED; | 211 typedef SampleView INHERITED; |
211 }; | 212 }; |
212 | 213 |
213 ////////////////////////////////////////////////////////////////////////////// | 214 ////////////////////////////////////////////////////////////////////////////// |
214 static SkView* MyFactory() { return new ShadowingView; } | 215 static SkView* MyFactory() { return new ShadowingView; } |
215 static SkViewRegister reg(MyFactory); | 216 static SkViewRegister reg(MyFactory); |
216 | 217 |
217 #endif | 218 #endif |
OLD | NEW |