src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java

Print this page

        

@@ -159,17 +159,22 @@
 
         LCMS.colorConvert(this, in, out);
     }
 
     public void colorConvert(BufferedImage src, BufferedImage dst) {
-        if (LCMSImageLayout.isSupported(src) &&
-            LCMSImageLayout.isSupported(dst))
-        {
-            doTransform(new LCMSImageLayout(src), new LCMSImageLayout(dst));
+        LCMSImageLayout srcIL, dstIL;
+
+        dstIL = LCMSImageLayout.createImageLayout(dst);
+
+        if (dstIL != null) {
+            srcIL = LCMSImageLayout.createImageLayout(src);
+            if (srcIL != null) {
+                doTransform(srcIL, dstIL);
             return;
         }
-        LCMSImageLayout srcIL, dstIL;
+        }
+
         Raster srcRas = src.getRaster();
         WritableRaster dstRas = dst.getRaster();
         ColorModel srcCM = src.getColorModel();
         ColorModel dstCM = dst.getColorModel();
         int w = src.getWidth();

@@ -437,10 +442,18 @@
     }
 
     public void colorConvert(Raster src, WritableRaster dst) {
 
         LCMSImageLayout srcIL, dstIL;
+        dstIL = LCMSImageLayout.createImageLayout(dst);
+        if (dstIL != null) {
+            srcIL = LCMSImageLayout.createImageLayout(src);
+            if (srcIL != null) {
+                doTransform(srcIL, dstIL);
+                return;
+            }
+        }
         // Can't pass src and dst directly to CMM, so process per scanline
         SampleModel srcSM = src.getSampleModel();
         SampleModel dstSM = dst.getSampleModel();
         int srcTransferType = src.getTransferType();
         int dstTransferType = dst.getTransferType();