[OpenJDK 2D-Dev] [9] Review Request: 8167310 The graphics clip is incorrectly rounded for some fractional scales
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Tue Oct 11 23:32:30 UTC 2016
On 11.10.16 23:12, Jim Graham wrote:
> Also, is it worth having a protective test for Rectangle in the
> intersect(Rectangle2D) method to avoid all of the double math when the
> rectangle was already an integer one?
Yes, this code can be moved from SunGraphics2D:
http://cr.openjdk.java.net/~serb/8167310/webrev.05
+ isNaN checks were added
>
> ...jim
>
> On 10/10/16 4:37 PM, Sergey Bylokhov wrote:
>> On 10.10.16 23:42, Jim Graham wrote:
>>> Can we also not use MAX_INT for the drawImage test case? Either have
>>> the drawImage follow the clip around or choose an appropriate non-limit
>>> size to cover the worst case scale with some margin for error...
>>
>> Something like this?
>> http://cr.openjdk.java.net/~serb/8167310/webrev.04
>>
>>
>>> On 10/10/16 12:45 PM, Sergey Bylokhov wrote:
>>>> An updated version:
>>>> http://cr.openjdk.java.net/~serb/8167310/webrev.03
>>>> - STROKE_PURE is used in the test, the line width is set to 2.01.
>>>> This also fixed the difference between clips(Shape vs
>>>> Rectangle).
>>>> - The if statement is changed as suggested.
>>>>
>>>> The additional questions:
>>>> - In the current fix we change behavior of the clip. Before the fix
>>>> if we set the clip to the nearest areas they can
>>>> overlaps in the destination. Should we change the drawImage as well?
>>>> Currently if I draw image to the nearest areas in
>>>> the user space, the images can overlap in the destination(so the
>>>> actual result in destination depends on what image was
>>>> painted first).
>>>> - Should the clip be affected by the stroke(if it was set by the
>>>> shape)? Right now if the clip was set by the shape it
>>>> will produce different result than if it was set via rectangle.
>>>>
>>>> On 10.10.16 22:29, Jim Graham wrote:
>>>>> That does sound like a problem. Does it do the same thing with new
>>>>> Path2D(Rectangle)? The Area class does some processing on the path
>>>>> and
>>>>> it would be nice to eliminate that as a potential source of this
>>>>> problem. I don't have a buildable JDK9 repo right now that I can fire
>>>>> off some quick tests on so I'll have to look at this later...
>>>>>
>>>>> ...jim
>>>>>
>>>>> On 10/10/16 12:04 PM, Sergey Bylokhov wrote:
>>>>>> On 10.10.16 21:55, Sergey Bylokhov wrote:
>>>>>>>> Will give us a pass on the test as long as we made the same
>>>>>>>> mistake for
>>>>>>>> both the rect clip and the shape clip. I think you want "(rgb !=
>>>>>>>> goldRGB) || (rgb != GREEN && rgb != RED)"...?
>>>>>>>
>>>>>>> Correct, I will update the test.
>>>>>>
>>>>>> surprisingly but it is produce the different results.... And I think
>>>>>> that the clip which is set via Shape is shifted,
>>>>>> because the first and last fillRects cover only the half of expected
>>>>>> area. But in case of clip=rectangle all fillRects
>>>>>> produce the same areas.
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
--
Best regards, Sergey.
More information about the 2d-dev
mailing list