Make GrAAConvexTessellator bail on paths that map to inf/nan in device space.

This makes us avoid hitting assertions when computing normals.

We could be better and clip but have to be careful about strokes.

Bug: 882609
Change-Id: I6550e7f8b912021fb8dfbcad7a03151dfb272b11
Reviewed-on: https://skia-review.googlesource.com/153664
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2018-09-11 13:19:19 -04:00 committed by Skia Commit-Bot
parent fb18639804
commit efa6bcb022

View File

@ -74,6 +74,7 @@ int GrAAConvexTessellator::addPt(const SkPoint& pt,
SkScalar coverage,
bool movable,
CurveState curve) {
SkASSERT(pt.isFinite());
this->validate();
int index = fPts.count();
@ -370,6 +371,14 @@ bool GrAAConvexTessellator::computePtAlongBisector(int startIdx,
bool GrAAConvexTessellator::extractFromPath(const SkMatrix& m, const SkPath& path) {
SkASSERT(SkPath::kConvex_Convexity == path.getConvexity());
SkRect bounds = path.getBounds();
m.mapRect(&bounds);
if (!bounds.isFinite()) {
// We could do something smarter here like clip the path based on the bounds of the dst.
// We'd have to be careful about strokes to ensure we don't draw something wrong.
return false;
}
// Outer ring: 3*numPts
// Middle ring: numPts
// Presumptive inner ring: numPts