[OpenJDK 2D-Dev] [9] request for review: 8041465: BMPImageReader read error using ImageReadParam with set sourceRectangle

Phil Race philip.race at oracle.com
Wed Sep 3 19:20:57 UTC 2014


Looks good.

-phil.

On 9/3/2014 5:23 AM, Andrew Brygin wrote:
> Hello,
>
>  could you please review a fix for CR 8041465?
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8041465
> Webrev: http://cr.openjdk.java.net/~bae/8041465/9/webrev.00/
>
>  The problem happens if we perform multiple read operations from
>  a source which is set only once. For instance, we can try to read
>  image in several tiles.
>
>  The root case of the problem is that we set stream position
>  to the start of raster data only once: when we complete
>  the processing of BMP header.  A peculiarity of BMP format
>  is that raster data can be stored in reverse order, so if we
>  request few leading scanlines first, then we skip rest of raster
>  data, and subsequent read command does not copy anything to the
>  destination buffer, because we never re-set the stream position
>  to the start of bitmap.
>
>  Suggested fix just saves the bitmap's start postilion and seeks
>  the stream to to it each time when we read image. This change
>  makes the BMP reader behavior exactly same as other standard plugin
>  demonstrate.
>
>  Supplied regression test demonstrates the problem.
>
>  Please take a look.
>
> Thanks,
> Andrew.




More information about the 2d-dev mailing list