RFR: 8264002: Delete outdated assumptions about ColorSpace initialization

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8264002: Delete outdated assumptions about ColorSpace initialization

Sergey Bylokhov-2
Some codes have outdated assumptions about the initialization of ColorSpace class.
 - The ColorSpace.getInstance() will never throw an IllegalArgumentException for the builtin profiles
 - The ColorSpace.getInstance() will not trigger initialisation of the CMM classes

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

Commit messages:
 - Initial version

Changes: https://git.openjdk.java.net/jdk/pull/3140/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3140&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264002
  Stats: 168 lines in 6 files changed: 45 ins; 94 del; 29 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3140.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3140/head:pull/3140

PR: https://git.openjdk.java.net/jdk/pull/3140
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264002: Delete outdated assumptions about ColorSpace initialization

Sergey Bylokhov-2
On Tue, 23 Mar 2021 00:14:59 GMT, Sergey Bylokhov <[hidden email]> wrote:

> Some codes have outdated assumptions about the initialization of ColorSpace class.
>  - The ColorSpace.getInstance() will never throw an IllegalArgumentException for the builtin profiles
>  - The ColorSpace.getInstance() will not trigger initialisation of the CMM classes

src/java.desktop/share/classes/com/sun/imageio/plugins/common/ImageUtil.java line 1175:

> 1173:                 && !cs.equals(ColorSpace.getInstance(ColorSpace.CS_CIEXYZ))
> 1174:                 && !cs.equals(ColorSpace.getInstance(ColorSpace.CS_PYCC));
> 1175:     }

The method above was added by the tiff implementation in jdk9 and it is mostly a copy of the older code in the jpeg plugin. I merged two methods and leave it here in the "common" code.

src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEG.java line 205:

> 203:      * of the CMM class until someone actually needs it.
> 204:      * (e.g. do not init CMM on the request for jpeg mime types)
> 205:      */

It is not necessary to delay the usage of ColorSpace, it itself defers the usage of cmm.

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

PR: https://git.openjdk.java.net/jdk/pull/3140
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264002: Delete outdated assumptions about ColorSpace initialization

Alexander Zvegintsev-2
In reply to this post by Sergey Bylokhov-2
On Tue, 23 Mar 2021 00:14:59 GMT, Sergey Bylokhov <[hidden email]> wrote:

> Some codes have outdated assumptions about the initialization of ColorSpace class.
>  - The ColorSpace.getInstance() will never throw an IllegalArgumentException for the builtin profiles
>  - The ColorSpace.getInstance() will not trigger initialisation of the CMM classes

Looks good to me.

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

Marked as reviewed by azvegint (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3140
Reply | Threaded
Open this post in threaded view
|

Integrated: 8264002: Delete outdated assumptions about ColorSpace initialization

Sergey Bylokhov-2
In reply to this post by Sergey Bylokhov-2
On Tue, 23 Mar 2021 00:14:59 GMT, Sergey Bylokhov <[hidden email]> wrote:

> Some codes have outdated assumptions about the initialization of ColorSpace class.
>  - The ColorSpace.getInstance() will never throw an IllegalArgumentException for the builtin profiles
>  - The ColorSpace.getInstance() will not trigger initialisation of the CMM classes

This pull request has now been integrated.

Changeset: cfc9aa34
Author:    Sergey Bylokhov <[hidden email]>
URL:       https://git.openjdk.java.net/jdk/commit/cfc9aa34
Stats:     168 lines in 6 files changed: 45 ins; 94 del; 29 mod

8264002: Delete outdated assumptions about ColorSpace initialization

Reviewed-by: azvegint

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

PR: https://git.openjdk.java.net/jdk/pull/3140