RFR: 8318850: Duplicate code in the LCMSImageLayout

Sergey Bylokhov serb at openjdk.org
Thu Oct 26 05:15:58 UTC 2023


Small cleanup:
 * The code to handle the TYPE_XBYTE_XX and TYPE_BYTE_GRAY in the LCMSImageLayout  class is mostly identical, there is only one difference in offset calculation

                int firstBand = byteRaster.getSampleModel().getNumBands() - 1;
                l.offset = byteRaster.getDataOffset(firstBand);
or
                l.offset = byteRaster.getDataOffset(0);

But since the TYPE_BYTE_GRAY  has only one band, both codes calculate the same value. so we can simply remove the special branch for TYPE_BYTE_GRAY

 * the PREMUL_SH method is replaced by the constant PREMUL since we always pass the "1" as a parameter

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

Commit messages:
 - Update VerifyNumBands.java
 - 8318850: Duplicate code in the LCMSImageLayout

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

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


More information about the client-libs-dev mailing list