[OpenJDK 2D-Dev] RFR: 8166038 BufferedImage methods getTileGridXOffset() and getTileGridYOffset() return a non 0 value for sub images
Philip Race
philip.race at oracle.com
Fri Apr 17 19:08:26 UTC 2020
So if this is "always zero", for BufferedImage, why aren't we just
directly returning zero ?
I'm a bit on the fence about this wondering whether to submit a CSR here,
since a behavioural change is being introduced in order to conform to
the spec,
and there is some compatibility issue possible.
-phil.
On 4/8/20, 3:23 PM, Sergey Bylokhov 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
>>
>>
>
>
More information about the 2d-dev
mailing list