Handle perspective scales in GrPathUtil scaleToleranceToSrc

Bug: skia:7769
Change-Id: Ibf52ebfe5bb79afd0358278fbd284084a10b076b
Reviewed-on: https://skia-review.googlesource.com/118180
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Greg Daniel 2018-04-04 08:55:52 -04:00 committed by Skia Commit-Bot
parent be77a02a67
commit c412b59582

View File

@ -31,7 +31,14 @@ SkScalar GrPathUtils::scaleToleranceToSrc(SkScalar devTol,
stretch = SkMaxScalar(stretch, mat.mapRadius(SK_Scalar1));
}
}
SkScalar srcTol = devTol / stretch;
SkScalar srcTol = 0;
if (stretch <= 0) {
// We have degenerate bounds or some degenerate matrix. Thus we set the tolerance to be the
// max of the path pathBounds width and height.
srcTol = SkTMax(pathBounds.width(), pathBounds.height());
} else {
srcTol = devTol / stretch;
}
if (srcTol < gMinCurveTol) {
srcTol = gMinCurveTol;
}