[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>
This commit is contained in:
Florin Malita 2017-02-08 15:35:42 -05:00 committed by Skia Commit-Bot
parent 73fe7b07e6
commit 69d8d66eae

View File

@ -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)