[OpenJDK 2D-Dev]  Request for review: 8004859 Graphics.getClipBounds/getClip return difference nonequivalent bounds, depending from transform.
Sergey.Bylokhov at oracle.com
Thu Dec 13 23:49:28 UTC 2012
14.12.2012 0:40, Jim Graham wrote:
> This fix breaks other behavior.
> You need to use setFrameFromDiagonal on the results of the transform
> because a flip or rotation can cause the transformed points to be
> unordered and setFFD will sort them as they need to be. It is the
> incoming rectangle that needs to be checked for being empty, not the
> results of the transform.
Yes, you are right. After the fix we can skip correct userclip, if it
Looks like correct solution for this issue is to use setFFD, if incoming
rectangle is not empty but transformed rectangle is empty, and use
opposite operation if incoming rectangle is empty but transformed
rectangle is not empty. So IsEmpty property should not be changed in
transformShape() method, Right?
Thanks for review!
> The case that will fail with this fix is setting the clip to a valid
> rectangle in a coordinate system that is rotated by a multiple of 90
> degrees or is flipped horizontally or vertically. Those cases will
> result in an empty clip, but the clip was not empty coming in...
> On 12/13/2012 3:08 AM, Sergey Bylokhov wrote:
>> Please review the fix for jdk 8.
>> Change description:
>> 1 transformShape now symmetric to untransformShape()
>> (setFrameFromDiagonal was removed).
>> 2 getClipBounds now always uses getBounds2D which does not return empty
>> Rectangle if the userclip has negative width or height.
>> Note that if the userclip has negative width or height, our real graphic
>> clip will be empty/no-area. This wasn't true before the fix for the
>> scaled graphics.
>> Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8004859
>> Webrev can be found at:
Best regards, Sergey.
More information about the 2d-dev