aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkMatrix.h
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2016-10-05 09:28:42 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-05 09:28:42 -0700
commit088e21ba652ceaa4abb4ba8cdd2ec1bc8afc32ed (patch)
treed85e228092824a9e721d5831947209842f2bdf1c /include/core/SkMatrix.h
parentc6618dd1dadeac8b47b81fbee108c42cca8ab166 (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.h9
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;