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, 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 a 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 cache 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 use some 
[default](https://github.com/LuaDist/lcms/blob/master/doc/TUTORIAL.TXT#L1094)
 * The old wrappers had a way to specifiy the input and output profiles, the 
LCMS library use the first profile as input and the last profile as output. 
That 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

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

Commit messages:
 - rename renderType to renderingIntent
 - Merge remote-tracking branch 'upstream/master' into tfmCleanup
 - Add a dot.
 - cleanup

Changes: https://git.openjdk.org/jdk/pull/10459/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10459&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8294488
  Stats: 282 lines in 9 files changed: 18 ins; 175 del; 89 mod
  Patch: https://git.openjdk.org/jdk/pull/10459.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10459/head:pull/10459

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

Reply via email to