[OpenJDK 2D-Dev] [9] Review Request: 8167310 The graphics clip is incorrectly rounded for some fractional scales

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Oct 7 13:18:24 UTC 2016


Please review the fix for jdk9.

This is bug which was found when the fractional scale is used in Swing. 
The problem is that if we save a usrClip as Rectangle2D then we 
incorrectly intersect it with device clip. The problem is in the 
RectangularShape.getBounds() method, see more details:

So getBounds() produces the bigger Rectangle than is necessary and our 
clip became bigger as well. This means that in some fractional scales 
such clips are overlapping.

The test will test fillRect, DrawImage, DrawLine methods and validates 
that there are no any overlapping if we set the clip.(The gaps between 
touched pixels are allowed only for lines).

Note that as I understand the code this fix should affect the DrawLines, 
because in some situations it is possible that two lines are overlapped 
without clip. And two other cases(fillRect, drawImage) should work 
without clip, but only fillRect works. It is discussed here:

Bug: https://bugs.openjdk.java.net/browse/JDK-8167310
Webrev can be found at: http://cr.openjdk.java.net/~serb/8167310/webrev.00

Best regards, Sergey.

More information about the 2d-dev mailing list