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 "SkPathEffect.h" | 8 #include "SkPathEffect.h" |
9 #include "SkShadowPaintFilterCanvas.h" | 9 #include "SkShadowPaintFilterCanvas.h" |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 newPaint.setColor(color); | 43 newPaint.setColor(color); |
44 | 44 |
45 *paint->writable() = newPaint; | 45 *paint->writable() = newPaint; |
46 } | 46 } |
47 | 47 |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
51 SkISize SkShadowPaintFilterCanvas::ComputeDepthMapSize(const SkLights::Light& li
ght, int maxDepth, | 51 SkISize SkShadowPaintFilterCanvas::ComputeDepthMapSize(const SkLights::Light& li
ght, int maxDepth, |
52 int width, int height) { | 52 int width, int height) { |
| 53 SkASSERT(light.type() != SkLights::Light::kAmbient_LightType); |
53 if (light.type() != SkLights::Light::kDirectional_LightType) { | 54 if (light.type() != SkLights::Light::kDirectional_LightType) { |
54 return SkISize::Make(width *2 , height * 2); | 55 return SkISize::Make(width *2 , height * 2); |
55 } | 56 } |
56 | 57 |
57 int dMapWidth = SkMin32(maxDepth * fabs(light.dir().fX) + width, | 58 int dMapWidth = SkMin32(maxDepth * fabs(light.dir().fX) + width, |
58 width * 2); | 59 width * 2); |
59 int dMapHeight = SkMin32(maxDepth * fabs(light.dir().fY) + height, | 60 int dMapHeight = SkMin32(maxDepth * fabs(light.dir().fY) + height, |
60 height * 2); | 61 height * 2); |
61 return SkISize::Make(dMapWidth, dMapHeight); | 62 return SkISize::Make(dMapWidth, dMapHeight); |
62 } | 63 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 243 } |
243 | 244 |
244 void SkShadowPaintFilterCanvas::onDrawTextBlob(const SkTextBlob *blob, SkScalar
x, SkScalar y, | 245 void SkShadowPaintFilterCanvas::onDrawTextBlob(const SkTextBlob *blob, SkScalar
x, SkScalar y, |
245 const SkPaint &paint) { | 246 const SkPaint &paint) { |
246 this->updateMatrix(); | 247 this->updateMatrix(); |
247 this->INHERITED::onDrawTextBlob(blob, x, y, paint); | 248 this->INHERITED::onDrawTextBlob(blob, x, y, paint); |
248 this->restore(); | 249 this->restore(); |
249 } | 250 } |
250 | 251 |
251 #endif | 252 #endif |
OLD | NEW |