RFR: 4954405: Data buffers created with an offset are unusable

Phil Race prr at openjdk.org
Tue Oct 14 03:35:39 UTC 2025


ByteInterleavedRaster is not including the DataBuffer offset in returns from getDataElements
The super-class sets it in the constructor which runs very much like this subclass except it omits this.
The parent class of ByteInterleavedRaster is ByteComponentRaster and it uses the DataBuffer offset
to adjust dataOffsets values used in all calculations.

Instead ByteInterleavedRaster  does something a bit different than other classes where it includes it in some instance vars
that also have additional offsets that apply for getPixels and getSamples but aren't used in getDataElements.

It looks to me as if this is what ByteInterleavedRaster should also do instead.
All existing tests pass, and this resolves the specific complaint in the bug report.

-------------

Commit messages:
 - 4954405

Changes: https://git.openjdk.org/jdk/pull/27782/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27782&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-4954405
  Stats: 75 lines in 2 files changed: 73 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/27782.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27782/head:pull/27782

PR: https://git.openjdk.org/jdk/pull/27782


More information about the client-libs-dev mailing list