GrTessellator: fix for points that become infinite on stroking.

stroke -> Inf -> NaN -> assert.

BUG=skia:7775

Change-Id: I086883bce90d1d473cff87f67e954718ea3181f6
Reviewed-on: https://skia-review.googlesource.com/118145
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Stephen White 2018-04-03 11:28:15 -04:00 committed by Skia Commit-Bot
parent b88045bdc2
commit ea49523b5f
2 changed files with 17 additions and 0 deletions

View File

@ -2015,6 +2015,10 @@ void stroke_boundary(EdgeList* boundary, VertexList* innerMesh, VertexList* oute
}
innerPoint1 = innerPoint2 = innerPoint;
}
if (!innerPoint1.isFinite() || !innerPoint2.isFinite() ||
!outerPoint1.isFinite() || !outerPoint2.isFinite()) {
continue;
}
LOG("inner (%g, %g), (%g, %g), ",
innerPoint1.fX, innerPoint1.fY, innerPoint2.fX, innerPoint2.fY);
LOG("outer (%g, %g), (%g, %g)\n",

View File

@ -460,6 +460,18 @@ static SkPath create_path_30() {
return path;
}
// A path with vertices which become infinite on AA stroking. Should not crash or assert.
static SkPath create_path_31() {
SkPath path;
path.moveTo(2.0257809259190991347e+36, -1244080640);
path.conicTo(2.0257809259190991347e+36, -1244080640,
2.0257809259190991347e+36, 0.10976474732160568237, 0.70710676908493041992);
path.lineTo(-10036566016, -1954718402215936);
path.conicTo(-1.1375507718551896064e+20, -1954721086570496,
10036566016, -1954721086570496, 0.70710676908493041992);
return path;
}
static std::unique_ptr<GrFragmentProcessor> create_linear_gradient_processor(GrContext* ctx) {
SkPoint pts[2] = { {0, 0}, {1, 1} };
@ -551,5 +563,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
test_path(ctx, rtc.get(), create_path_28(), SkMatrix(), GrAAType::kCoverage);
test_path(ctx, rtc.get(), create_path_29());
test_path(ctx, rtc.get(), create_path_30());
test_path(ctx, rtc.get(), create_path_31(), SkMatrix(), GrAAType::kCoverage);
}
#endif