Fix float overflow in shadow tessellator

Bug: skia:
Change-Id: Idc133df4ed8ed0922a756023365c9106c0efcf8b
Reviewed-on: https://skia-review.googlesource.com/153666
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
This commit is contained in:
Jim Van Verth 2018-09-11 14:16:42 -04:00 committed by Skia Commit-Bot
parent 17c66940d0
commit e6146bd7be

View File

@ -272,7 +272,8 @@ bool SkBaseShadowTessellator::computeConvexShadow(SkScalar inset, SkScalar outse
if (minDistSq < (inset + kTolerance)*(inset + kTolerance)) {
// if the umbra would collapse, we back off a bit on inner blur and adjust the alpha
auto newInset = SkScalarSqrt(minDistSq) - kTolerance;
auto ratio = 128 * (newInset + inset) / inset;
auto ratio = 128 * (newInset/inset + 1);
SkASSERT(SkScalarIsFinite(ratio));
// they aren't PMColors, but the interpolation algorithm is the same
umbraColor = SkPMLerp(kUmbraColor, kPenumbraColor, (unsigned)ratio);
inset = newInset;