aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-02-06 14:23:53 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-07 14:38:16 +0000
commit67386d44c77a1bef1cd9a896d779bd92ea03a558 (patch)
tree36a20b062ecbf64ea9248ff6483bdeecf7ef5a5f /src
parent8bb3b21a4a098e9bfe88209f84d50abf80e39792 (diff)
ShadowUtils: Fix umbra inset calculation when determining if umbra is fully occluded.
Change-Id: Id0db49ad45b341d39abf7ee532ecc0799a832192 Reviewed-on: https://skia-review.googlesource.com/8079 Commit-Queue: Stan Iliev <stani@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src')
-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;