RFR: 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
Laurent Bourgès
lbourges at openjdk.java.net
Sun May 22 10:33:54 UTC 2022
On Sun, 22 May 2022 09:08:03 GMT, Jeremy <duke at openjdk.java.net> wrote:
> This resolves an occasional unit test failure in Path2D.UnitTest.
>
> The previous Path2D#getBounds2D(PathIterator) implementation assumed that after a SEG_CLOSE the next segment would always be a SEG_MOVETO to start a new clearly defined segment. But the Path2D.UnitTest created random paths that didn't follow this expectation.
>
> This commit updates #getBounds2D(PathIterator) so it will move the cursor back to the (moveX, moveY) point for the sake of calculating future segments. This appears to resolve the unit test failures.
>
> This commit also modifies the unit test so it logs random seeds. This may help developers isolate/reproduce specific failures with more certainty.
A general comment from an openjdk comitter, not reviewer:
It looks overall good, I would have named moveX/Y as startX/Y, as usual.
Should we test closed paths and non-closed paths to ensure bounds2d is correct in both case ? Maybe it is already the case.
Congratulations,
Laurent
-------------
PR: https://git.openjdk.java.net/jdk/pull/8828
More information about the client-libs-dev
mailing list