[OpenJDK 2D-Dev] RFR: 8166038 BufferedImage methods getTileGridXOffset() and getTileGridYOffset() return a non 0 value for sub images
Jayathirth D v
JAYATHIRTH.D.V at ORACLE.COM
Fri Apr 17 10:58:58 UTC 2020
Hi,
Change looks good to me.
I have a question regarding test case. Why test has to check whether we are getting negative value or not and then calculate whether the tileGridOffset is 0. From different function's specification in BufferedImage I see that there are no multiple tiles support.
I went through mail thread related to how we are comparing it to JAI’s implementation. But I think we can still keep the test case to be minimal and just check for 0 grid offset values.
Thanks,
Jay
> On 09-Apr-2020, at 3:53 AM, Sergey Bylokhov <Sergey.Bylokhov at oracle.com> wrote:
>
> An updated version of the fix:
> http://cr.openjdk.java.net/~serb/8166038/webrev.01
>
> On 4/2/20 12:49 am, Martin Desruisseaux wrote:
>> Le 02/04/2020 à 05:11, Sergey Bylokhov a écrit :
>>> The idea of the fix looks fine, but probably the new comment in the "getTileGridXOffset" overkill and we can move it to the test instead.
>>>
>> Thanks, no problem.
>> I though after, as a matter of principle, the following line in the test:
>> final int tileX = (x - tileGridXOffset) / image.getTileWidth();
>> could be replaced by:
>> final int tileX = Math.floorDiv(x - tileGridXOffset, image.getTileWidth());
>> and same for Y. It would change nothing for this test since it uses positive values, but maybe using the formula valid in the general case is safer in case someone picks it up and uses it in another context.
>> Martin
>
>
> --
> Best regards, Sergey.
More information about the 2d-dev
mailing list