[OpenJDK 2D-Dev]  request for review: 8041465: BMPImageReader read error using ImageReadParam with set sourceRectangle
andrew.brygin at oracle.com
Wed Sep 3 12:23:32 UTC 2014
could you please review a fix for CR 8041465?
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
Supplied regression test demonstrates the problem.
Please take a look.
More information about the 2d-dev