On Wed, 28 Sep 2022 03:12:55 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
> This is a request to cleanup the shared code for the colors conversions. That > code still uses some wrappers which can be simplified and/or deleted after > KCMS removal. For example, each conversion from one color space to another > creates 3 wrappers - for the first color profile, the second color profile, > and one to combine the first two. But for the lcms library we only need the > list of color profiles and rendering intent -> only one transform object can > be used. > > The new constructor for the LCMSTransform is > [added](https://github.com/openjdk/jdk/pull/10459/files#diff-7448ea8346eb08c6ec1a518e3c3399d7d078a514c07956ee7e8e2b5be3d082e1R77) > and now used everywhere: > `LCMSTransform(int renderingIntent, ICC_Profile... profiles)` > It will wrap the `cmsCreateMultiprofileTransform` [function > ](https://github.com/openjdk/jdk/pull/10459/files#diff-eed6ddb15e9c5bdab9fc3b3930d5d959966165d9622ddd293e8572489adea98bR202) > in LCMS library: > > I tried to preserve the current behavior, and as a result, two "workarounds" > are used for the next bugs. > * [JDK-8216369](https://bugs.openjdk.org/browse/JDK-8216369): after the > cleanup it became obvious that we use a hardcoded value for the first > rendering > [intent](https://github.com/openjdk/jdk/pull/10459/files#diff-e3d6eea060882cab00827c00e1a83b0e0a5b2a31fa9a9aa2122841bbd57c4a6dR473). > There is a code to fetch the intent from the color profile but I postponed > use it for now because some of our built-in profiles use different default > intents. > * [JDK-8272860](https://bugs.openjdk.org/browse/JDK-8272860): the old code > always fetched some information from the color profile header as result we > cache the headers for any profiles we used. This cache workaround the > JDK-8272860 while the direct access to the profile via LCMS library could > fail. The new code intentionally caches the > [header](https://github.com/openjdk/jdk/pull/10459/files#diff-7448ea8346eb08c6ec1a518e3c3399d7d078a514c07956ee7e8e2b5be3d082e1R91). > > Notes: > * The old wrappers used a rendering intent for each intermediate transform, > the LCMS use only one intent > * The old wrappers could throw the cmm exception if the rendering intent was > not supported. The LCMS ignores unsupported intents and uses some > [default](https://github.com/LuaDist/lcms/blob/master/doc/TUTORIAL.TXT#L1094) > * The old wrappers had a way to specify the input and output profiles, the > LCMS library uses the first profile as input and the last profile as output. > Those parameters are > [removed](https://github.com/openjdk/jdk/pull/10459/files#diff-81b49f067b32296497e9e727bda25efe0b7f84fb2c05645eb6b272bfc32469f1L38) > * If at some point the new CMS library will be added it will be easy to > integrate it using XXCMS plugin, instead of using some specific library logic > in the shared code I've prepared a closed PR which fixes the closed test to match this change It needs to be pushed at the same time but it has yet to be reviewed. Once it is approved we can co-ordinate pushing both at the same time. ------------- PR: https://git.openjdk.org/jdk/pull/10459