RFR: 8318850: Duplicate code in the LCMSImageLayout

Phil Race prr at openjdk.org
Thu Oct 26 19:08:30 UTC 2023


On Thu, 26 Oct 2023 01:14:57 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

> 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

looks fine.

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

Marked as reviewed by prr (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16371#pullrequestreview-1700467141


More information about the client-libs-dev mailing list