diff options
author | 2017-02-08 15:35:42 -0500 | |
---|---|---|
committer | 2017-02-08 21:23:54 +0000 | |
commit | 69d8d66eae7688f4c5485428e06866a274af0c0e (patch) | |
tree | 0facf05debaf3ce82375fe06678ae4e5d0979e40 /src/effects/gradients/Sk4fLinearGradient.cpp | |
parent | 73fe7b07e6391da81dfc48d600d7b3141be1f471 (diff) |
[4fGradient] Fix degenerate vertical gradient assert
For vertical gradients, we rely on LinearIntervalProcessor to yield a
fAdvX == +inf, thanks to division by dx (== +/-0).
But certain degenerate values may cause the numerator to also collapse
to 0, resulting in fAdvX == NaN.
Instead or relying on float semantics, pin fAdvX to +inf explicitly for
vertical gradients.
BUG=skia:5912
Change-Id: Ia8007b99802a6b1e0b22f5618a0ca8959b0cfbb2
Reviewed-on: https://skia-review.googlesource.com/8223
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/effects/gradients/Sk4fLinearGradient.cpp')
-rw-r--r-- | src/effects/gradients/Sk4fLinearGradient.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/effects/gradients/Sk4fLinearGradient.cpp b/src/effects/gradients/Sk4fLinearGradient.cpp index 229bf8212f..ba4d3c6a9e 100644 --- a/src/effects/gradients/Sk4fLinearGradient.cpp +++ b/src/effects/gradients/Sk4fLinearGradient.cpp @@ -295,7 +295,7 @@ public: SkScalar fx, SkScalar dx, bool is_vertical) - : fAdvX((i->fP1 - fx) / dx) + : fAdvX(is_vertical ? SK_ScalarInfinity : (i->fP1 - fx) / dx) , fFirstInterval(firstInterval) , fLastInterval(lastInterval) , fInterval(i) |