aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDraw.cpp
diff options
context:
space:
mode:
authorGravatar lsalzman <lsalzman@mozilla.com>2016-07-06 12:19:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-06 12:19:56 -0700
commita4b8704e76cb2136a3ff8c1553690f30b96870e0 (patch)
treef11a677998f59dfee35a0ec3bfa054eee73fee2a /src/core/SkDraw.cpp
parent5c4a381b3129df887559a5a053171814950605c0 (diff)
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
Diffstat (limited to 'src/core/SkDraw.cpp')
-rw-r--r--src/core/SkDraw.cpp5
1 files changed, 4 insertions, 1 deletions
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;