[OpenJDK 2D-Dev] RFR: 8166038 BufferedImage methods getTileGridXOffset() and getTileGridYOffset() return a non 0 value for sub images

Martin Desruisseaux martin.desruisseaux at geomatys.com
Thu Apr 2 07:49:07 UTC 2020


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/2d-dev/attachments/20200402/5d980053/attachment.htm>


More information about the 2d-dev mailing list