[OpenJDK 2D-Dev] [8] Request for review: 8004859 Graphics.getClipBounds/getClip return difference nonequivalent bounds, depending from transform.

Jim Graham james.graham at oracle.com
Thu Jan 17 00:56:41 UTC 2013

Hi Sergey,

I have one remaining question:

On 1/14/13 11:44 AM, Sergey Bylokhov wrote:
>> - I still think that we don't owe anybody any need to preserve the
>> size of the empty clip so the adjustments for cases that fail the
>> above tests could simply be "m[2] = m[0]" and thus we get an empty
>> result.  Why did you feel that we need to maintain the sizes of empty
>> rectangles?  Was it just JCK test failures?
> Well I have only one reason to do it: If the user's code works with
> non-scaled Graphics, which is default, and it will fail when we change
> internal type of the graphics  -> That's a problem. This is directly
> related to the retina support, when in general nothing should be changed
> for the existing applications.

The original code in getClipBounds would end up returning a "new 
Rectangle()" if the clip was an empty rectangle due to the way that 
"Rectangle2D/Path2D.getBounds()" works.  You now use 
setFrame(getBounds2D()) which will attempt to preserve the dimensions of 
empty clips.  So, the "preserve the size of an empty clip" support is new.

I then mentioned that we don't need to go out of our way to preserve the 
dimensions of an empty clip, but you seem to be saying that we don't 
want to change this behavior - but your new code represents the break 
with existing behaviors, no?


More information about the 2d-dev mailing list