diff options
author | fmalita <fmalita@chromium.org> | 2016-10-05 09:28:42 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-05 09:28:42 -0700 |
commit | 088e21ba652ceaa4abb4ba8cdd2ec1bc8afc32ed (patch) | |
tree | d85e228092824a9e721d5831947209842f2bdf1c /include/core/SkMatrix.h | |
parent | c6618dd1dadeac8b47b81fbee108c42cca8ab166 (diff) |
Harden degenerate gradient context handling
Certain inputs produce degenerate values at context creation time only.
Detect such cases after context creation, and abort drawing by returning
a null shader context instead.
BUG=skia:5821
R=reed@google.com,brianosman@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2397473003
Review-Url: https://codereview.chromium.org/2397473003
Diffstat (limited to 'include/core/SkMatrix.h')
-rw-r--r-- | include/core/SkMatrix.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h index 19103843bf..f565a537ba 100644 --- a/include/core/SkMatrix.h +++ b/include/core/SkMatrix.h @@ -736,6 +736,11 @@ public: this->setTypeMask(mask | kRectStaysRect_Mask); } + /** + * Are all elements of the matrix finite? + */ + bool isFinite() const { return SkScalarsAreFinite(fMat, 9); } + private: enum { /** Set if the matrix will map a rectangle to another rectangle. This @@ -768,10 +773,6 @@ private: SkScalar fMat[9]; mutable uint32_t fTypeMask; - /** Are all elements of the matrix finite? - */ - bool isFinite() const { return SkScalarsAreFinite(fMat, 9); } - static void ComputeInv(SkScalar dst[9], const SkScalar src[9], double invDet, bool isPersp); uint8_t computeTypeMask() const; |