Fix Rect::round(_out)
#157
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
"Round these floating-point bounds outwards to integer coordinates" is a common operation for 2D graphics libraries, and half of the ones I see implement it incorrectly, as did tiny-skia.
Let's say we have a path that is 2px wide, at x = 0.5:

It at least partially covers columns 0, 1, and 2. That's 3 columns, so its rounded bounding box is 3 pixels wide. However, taking the ceiling of the width independent of its position would say it's 2 pixels wide!
We need to take the fractional position of the bounding box into account when calculating its rounded width and height. Or to put it another way, we need to convert the bottom and right edges into absolute coordinates before taking the ceiling, and then convert those back into relative coordinates.
Not changed in this PR, but now I'm suspicious of it: instead of always rounding the width and height up to 1, should we be returning
Noneif they are not strictly positive?