diff options
author | Florin Malita <fmalita@chromium.org> | 2017-07-03 18:44:17 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-03 23:20:52 +0000 |
commit | 974aad487a81e507ca9e953e0b7e016a42ba3c39 (patch) | |
tree | 75605333a8f7e1695b5c7bfe836938326a791525 | |
parent | a920d367bf9b3724f66173e4aa702ca09f680dea (diff) |
Handle degenerate 2pt conical center values gracefully
SkMatrix::setPolyToPoly() may fail to map degenerate values. Handle
this case explicitly, instead of assuming it never fails.
BUG=chromium:738746
TBR=
Change-Id: Ie1049b98f7e07ae5d6bdb706ba7b4a399388e5d8
Reviewed-on: https://skia-review.googlesource.com/21375
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
-rw-r--r-- | src/shaders/gradients/SkTwoPointConicalGradient.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shaders/gradients/SkTwoPointConicalGradient.cpp b/src/shaders/gradients/SkTwoPointConicalGradient.cpp index 0f48affc85..f79e78c310 100644 --- a/src/shaders/gradients/SkTwoPointConicalGradient.cpp +++ b/src/shaders/gradients/SkTwoPointConicalGradient.cpp @@ -204,7 +204,9 @@ bool SkTwoPointConicalGradient::adjustMatrixAndAppendStages(SkArenaAlloc* alloc, SkMatrix map_to_unit_vector; const SkPoint centers[2] = { fCenter1, fCenter2 }; const SkPoint unitvec[2] = { {0, 0}, {1, 0} }; - SkAssertResult(map_to_unit_vector.setPolyToPoly(centers, unitvec, 2)); + if (!map_to_unit_vector.setPolyToPoly(centers, unitvec, 2)) { + return false; + } matrix->postConcat(map_to_unit_vector); // Since we've squashed the centers into a unit vector, we must also scale |