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>
This commit is contained in:
Jim Van Verth 2017-02-16 10:01:46 -05:00 committed by Skia Commit-Bot
parent 3befb84efc
commit d25cc9b548

View File

@ -119,8 +119,8 @@ bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
SkRect bounds = args.fShape->styledBounds(); SkRect bounds = args.fShape->styledBounds();
SkScalar minDim = SkMinScalar(bounds.width(), bounds.height()); SkScalar minDim = SkMinScalar(bounds.width(), bounds.height());
SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height()); SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height());
SkScalar minSize = minDim * scaleFactors[0]; SkScalar minSize = minDim * SkScalarAbs(scaleFactors[0]);
SkScalar maxSize = maxDim * scaleFactors[1]; SkScalar maxSize = maxDim * SkScalarAbs(scaleFactors[1]);
return maxDim <= kMaxDim && kMinSize <= minSize && maxSize <= kMaxSize; return maxDim <= kMaxDim && kMinSize <= minSize && maxSize <= kMaxSize;
} }
@ -245,7 +245,7 @@ private:
const Entry& args = fShapes[i]; const Entry& args = fShapes[i];
// get mip level // get mip level
SkScalar maxScale = this->viewMatrix().getMaxScale(); SkScalar maxScale = SkScalarAbs(this->viewMatrix().getMaxScale());
const SkRect& bounds = args.fShape.bounds(); const SkRect& bounds = args.fShape.bounds();
SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height()); 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) // We try to create the DF at a power of two scaled path resolution (1/2, 1, 2, 4, etc)