[OpenJDK 2D-Dev] [9] Review Request: 8167310 The graphics clip is incorrectly rounded for some fractional scales
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Mon Oct 10 18:55:00 UTC 2016
On 10.10.16 21:31, Jim Graham wrote:
> OK, but you only need a line width of 2.0 to cover the gap regardless of
> scale. Line width scales in user space so larger scales scale up the
> line width along with the clip region being rendered. With
> STROKE_CONTROL on, 2.0 is plenty because the line is normalized (though
> I'm not sure the test should assume that). WITH STROKE_PURE, 2.0 is
> precisely exactly the right amount. Round-off error might theoretically
> bite us, so maybe 2.01 just to be safe.
When I tried to use w=2/3/4/5 I got a situation when no lines are drawn
to the image. I guess to paint something we need to cover at least half
of the pixel, this is not the case when line is w=2 and small scale is used.
> In the drawImage case in the test, is there a reason to stretch the
> image to MAX_INT size? Isn't (img,0,0,null) enough? The issue with the
> MAX_INT arguments is that this then becomes not only a test of clipping,
> but a test for how our image scaling handles huge scales that might
> overflow. Those should be tested independently if we fear there is a
> problem with image scaling.
This is extreme case which I tried to test, intersect the clip + the
scale on graphics + the scale from drawImage, since this huge
coordinates also can affect the clip, if intersection will be done
incorrectly.
>
> Also, This line in the test case:
>
> 161 if (rgb != goldRGB && rgb != GREEN.getRGB()
> 162 && rgb != RED.getRGB()) {
>
> 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.
--
Best regards, Sergey.
More information about the 2d-dev
mailing list