Integrated: 8318850: Duplicate code in the LCMSImageLayout

Sergey Bylokhov serb at openjdk.org
Fri Oct 27 18:24:42 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

This pull request has now been integrated.

Changeset: d2260146
Author:    Sergey Bylokhov <serb at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/d2260146c9930002e430a874f2585d699dedc155
Stats:     75 lines in 2 files changed: 57 ins; 11 del; 7 mod

8318850: Duplicate code in the LCMSImageLayout

Reviewed-by: prr

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

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


More information about the client-libs-dev mailing list