[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] BufferedImage.getTileGridXOffset() not compliant with its specification?
From:       Sergey Bylokhov <Sergey.Bylokhov () oracle ! com>
Date:       2020-03-09 22:24:30
Message-ID: 16881f25-0775-eb02-825e-36c50b57f282 () oracle ! com
[Download RAW message or body]

On 3/9/20 6:29 am, Martin Desruisseaux wrote:
> Thanks for the analysis. I can volunteer for creating the CSR if I can have some \
> pointers (e.g. template) to follow?

Let's start with the fix/test. Send me a patch and I will upload it to the \
cr.openjdk, so will be able to send an official review request.

> Indeed, I though that Graphics2D may have "if (image instanceof BufferedImage)" \
> optimizations that hides the issue. My plan was to create a test with a \
> RenderedImage wrapping a BufferedImage, which would prevent Graphics2D to use such \
> fast track, and see how it behaves. What I can said however is that Graphics2D \
> works well with multi-tiled images compliant with the specification, such as \
> javax.media.jai.TiledImage [1]. 
> For the formula used for "pixel coordinates to tile indices" calculation, we can \
> use source code of [2] as a reference. 
> [1]https://docs.oracle.com/cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/TiledImage.html
>  [2]https://docs.oracle.com/cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/PlanarImage.html#XToTileX(int,%20int,%20int)
>  
> Regards,
> 
> Martin
> 
> 
> Le 09/03/2020 à 01:29, Sergey Bylokhov a écrit :
> 
> > I have checked the history of these methods and their usage.
> > 
> > These methods were added to the BufferedImage back in 1997 when the
> > generic support of rendered images was added. Since then these methods
> > were used in the implementation of Graphics2D.drawRenderedImage(), but
> > in fact for BufferedImage they are never called [1]. I think it is
> > possible to change getTileGridXOffset()/getTileGridYOffset to return 0.
> > But it will be necessary to create a CSR, since the change has
> > compatibility impact.
> > 
> > [1] https://github.com/openjdk/client/blob/master/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java#L2662
> > 
> 


-- 
Best regards, Sergey.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic