[OpenJDK 2D-Dev] RFR: 8264002: Delete outdated assumptions about ColorSpace initialization

Sergey Bylokhov serb at openjdk.java.net
Tue Mar 23 05:00:50 UTC 2021

On Tue, 23 Mar 2021 00:14:59 GMT, Sergey Bylokhov <serb at openjdk.org> 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

More information about the 2d-dev mailing list