From a4b8704e76cb2136a3ff8c1553690f30b96870e0 Mon Sep 17 00:00:00 2001 From: lsalzman Date: Wed, 6 Jul 2016 12:19:56 -0700 Subject: check for zero scale in SkDraw::ComputeResScaleForStroking If the transform used to compute the res scale has both 0 scale and skew, then it will currently compute a 0 res scale. This causes getFillPath to trigger an assertion while using SkStroke since that can't handle a 0 res scale. Downstream Firefox bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1284356 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2125933003 Review-Url: https://codereview.chromium.org/2125933003 --- src/core/SkDraw.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/core/SkDraw.cpp') diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index e7bacab8ac..efc43d2e80 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -1006,7 +1006,10 @@ SkScalar SkDraw::ComputeResScaleForStroking(const SkMatrix& matrix) { SkScalar sx = SkPoint::Length(matrix[SkMatrix::kMScaleX], matrix[SkMatrix::kMSkewY]); SkScalar sy = SkPoint::Length(matrix[SkMatrix::kMSkewX], matrix[SkMatrix::kMScaleY]); if (SkScalarsAreFinite(sx, sy)) { - return SkTMax(sx, sy); + SkScalar scale = SkTMax(sx, sy); + if (scale > 0) { + return scale; + } } } return 1; -- cgit v1.2.3