8180877: More deeply colored ICC spaces
authorprr
Thu, 29 Jun 2017 11:53:19 -0700
changeset 48566 6c986cf7299a
parent 48565 871b8bb201ea
child 48567 c4de888db380
8180877: More deeply colored ICC spaces Reviewed-by: serb, rhalade, mschoene
src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java
src/java.desktop/share/native/liblcms/LCMS.c
--- a/src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java	Mon Jun 05 12:36:15 2017 -0300
+++ b/src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java	Thu Jun 29 11:53:19 2017 -0700
@@ -128,6 +128,18 @@
     }
 
     /**
+     * Validate an ICC_ColorSpace read from an object input stream
+     */
+    private void readObject(java.io.ObjectInputStream s)
+        throws ClassNotFoundException, java.io.IOException {
+
+        s.defaultReadObject();
+        if (thisProfile == null) {
+            thisProfile = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
+        }
+    }
+
+    /**
     * Returns the ICC_Profile for this ICC_ColorSpace.
     * @return the ICC_Profile for this ICC_ColorSpace.
     */
--- a/src/java.desktop/share/native/liblcms/LCMS.c	Mon Jun 05 12:36:15 2017 -0300
+++ b/src/java.desktop/share/native/liblcms/LCMS.c	Thu Jun 29 11:53:19 2017 -0700
@@ -644,7 +644,12 @@
 {
     jclass clsLcmsProfile;
     jobject cmmProfile;
-    jfieldID fid = (*env)->GetFieldID (env,
+    jfieldID fid;
+
+    if (pf == NULL) {
+        return NULL;
+    }
+    fid = (*env)->GetFieldID (env,
         (*env)->GetObjectClass(env, pf),
         "cmmProfile", "Lsun/java2d/cmm/Profile;");
     if (fid == NULL) {