Fix DistanceFieldPathRenderer assert.
If there's a reflection in the matrix, the scales
could be negative.
BUG=chromium:682918
Change-Id: Ifde42c3bc8b1f2938009b47d3a8380cf871448e9
Reviewed-on: https://skia-review.googlesource.com/8541
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
index 7131e18..17cd244 100644
--- a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
@@ -119,8 +119,8 @@
SkRect bounds = args.fShape->styledBounds();
SkScalar minDim = SkMinScalar(bounds.width(), bounds.height());
SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height());
- SkScalar minSize = minDim * scaleFactors[0];
- SkScalar maxSize = maxDim * scaleFactors[1];
+ SkScalar minSize = minDim * SkScalarAbs(scaleFactors[0]);
+ SkScalar maxSize = maxDim * SkScalarAbs(scaleFactors[1]);
return maxDim <= kMaxDim && kMinSize <= minSize && maxSize <= kMaxSize;
}
@@ -245,7 +245,7 @@
const Entry& args = fShapes[i];
// get mip level
- SkScalar maxScale = this->viewMatrix().getMaxScale();
+ SkScalar maxScale = SkScalarAbs(this->viewMatrix().getMaxScale());
const SkRect& bounds = args.fShape.bounds();
SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height());
// We try to create the DF at a power of two scaled path resolution (1/2, 1, 2, 4, etc)