aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xsrc/utils/SkShadowUtils.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils/SkShadowUtils.cpp b/src/utils/SkShadowUtils.cpp
index ba4decc80d..c4b4e3d48e 100755
--- a/src/utils/SkShadowUtils.cpp
+++ b/src/utils/SkShadowUtils.cpp
@@ -499,6 +499,10 @@ void SkShadowUtils::DrawShadow(SkCanvas* canvas, const SkPath& path, SkScalar oc
SkScalar hh = h / 2.f;
SkScalar umbraInsetX = s * hw + factory.fRadius;
SkScalar umbraInsetY = s * hh + factory.fRadius;
+ // The umbra is inset by radius along the diagonal, so adjust for that.
+ SkScalar d = 1.f / SkScalarSqrt(hw * hw + hh * hh);
+ umbraInsetX *= hw * d;
+ umbraInsetY *= hh * d;
if (umbraInsetX > hw || umbraInsetY > hh) {
// There is no umbra to occlude.
factory.fOccluderType = SpotVerticesFactory::OccluderType::kTransparent;