Handle recursion limit gracefully in the stroker
Before: If we ever reached the recursion limit (ie, no forward progress
subdividing a curve), we would give up on that branch of work. This
resulted in the recursion unwinding completely, causing the algorithm to
stop prematurely. Then, we'd simply close the resulting path, part-way
through stroking. The end result was that the stroked path would have a
big fill cutting across the middle (from wherever we gave up, back to
the path's first point).
Now: When we reach the recursion limit, we just emit a line, and stop
trying to subdivide. We're almost certainly in a spot where no one can
tell (the failure is a degenerate numerical issue anyway).
This lets us continue stroking, and produce plausible (probably correct
within human tolerance) results. The actual resulting paths are going to
be extremely large and slow to draw (hitting this limit means we tried
to subdivide ~30 times), but that's much better than before.
Interestingly, we had bug reports for this that involved each of the
relevant curve types (quad, cubic, and conic), so we have test GMs for
all three now. Each one drew wrong before the relevant fix, and now
looks correct.
Bug: b/40043963
Bug: b/41422450
Bug: b/40810065
Change-Id: I97b0863e33ece5ba2a82d6dcd4452a91ee396adc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/817621
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2 files changed