[OpenJDK 2D-Dev] [9] Review request for 8160124 SunGraphics2D.hitClip() can give wrong result for floating point scale
Phil Race
philip.race at oracle.com
Thu Jun 23 17:46:45 UTC 2016
On 06/23/2016 05:04 AM, Alexandr Scherbatiy wrote:
>
> Hello,
>
> Could you review the fix:
> bug: https://bugs.openjdk.java.net/browse/JDK-8160124
> webrev: http://cr.openjdk.java.net/~alexsch/8160124/webrev.00
>
> Let's set the clip [x=5, y=5, width=5, height=5] to a graphics and
> call the hitClip() with the passed rectangle [x=0, y=0, width=5,
> height=5].
>
> The result is false for the graphics with scale 1 and true if the
> scale is floating point 1.5.
>
> This is because the transformed clip which has floating point bounds
> [7.5, 7.5, 7.5, 7.5]
You must mean the latter two as width and height of the bounding
rectangle, not x2, y2.
bounds would be [7.5, 7.5, 15.0, 15.0] -
> for the scale 1.5 has bounds with rounded down upper-left and rounded
> up lower-right corners [7, 7, 8, 8]
similarly you mean the width/height would be rounded up to 8 - not the
corner location.
anyway .. +1 from me but this is one Jim should look at too.
-phil.
> which now intersects with the transformed rectangle [0, 0, 7.5, 7.5].
>
> The proposed fix adds additional check for the user clip and the
> user rectangle intersection if the intersection with the region clip
> passes.
>
> Thanks,
> Alexandr.
>
>
More information about the 2d-dev
mailing list