Replicate stroked line endpoints when converting to cubics

For lines with very large floating point coordinates, Wang's formula
doesn't actually return a value close to 0, even though the exact math
should for lines encoded as (a, 2/3a+1/3b, 1/3a+2/3b, b).

Since PatchWriter assumes the lines only need one segment, it doesn't
evaluate Wang's formula for lines. When the GPU re-evaluates Wang's
formula for a cubic that happened to come from a line, it can then have
a significant over estimate in the number of segments required if the
coordinates are really large.

This has been mitigated by GrStrokeTessellationShader uploading the
max edge count as a uniform so that the over-estimate is then clamped
back to a more reasonable value. By switching to (a, a, b, b), the
cubic is still visually a line but can be inspected quickly in the
shader and just skip evaluating Wang's formula entirely. This means
we will always use a single segment, and we unblock later changes that
let us remove the max-edge-count uniform from the stroke tessellation
shader.

It is possible that we could add the new trait and shader detection
logic to the fill curve and wedge shaders, but they aren't susceptible
to this because they don't rely on sk_VertexID to reconstruct 't'.

Bug: skia:12703, skia:13056
Change-Id: I95324a70d6429fef74d8abfaf6adaf95480a0879
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/532014
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
3 files changed