[ganesh] Fix bounds for subpixel StrokeRectOps
The StrokeRectOp always draws at least a 1px strip of geometry. If
`rect` is the device-space coordinates of the rect, then `devOutside`
is initially `rect.outset(info.fDevHalfStrokeSize)`. The inner edge
of the stroke is `rect.inset(info.fDevHalfStrokeSize)` and then that
is outset by 1px for the vertex positions if fDevHalfStrokeSize < 1/2.
When we report IsHairline::kYes, Ganesh adds an additional 1/2px outset
to the reported bounds. If we went that route, for a stroke radius of
`r`, the reported bounds would be `rect` outset by (r + 1/2). However,
the actual drawn bounds are `rect` outset by (1 - r). When r < 1/2,
it's not always true that r + 1/2 > 1 - r. As such, we manually
calculate what the StrokeRectOp's special hairline bounds are and
report that while still claiming IsHairline::kNo.
Bug: b/442293392
Change-Id: Ie4b5e44e95bbc1a6a232883a13dbe2ea1e289466
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1057176
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
1 file changed