src/share/native/sun/java2d/cmm/lcms/LCMS.c

Print this page

        

@@ -115,10 +115,11 @@
 static jfieldID IL_dataArray_fID;
 static jfieldID IL_offset_fID;
 static jfieldID IL_nextRowOffset_fID;
 static jfieldID IL_width_fID;
 static jfieldID IL_height_fID;
+static jfieldID IL_imageAtOnce_fID;
 static jfieldID PF_ID_fID;
 
 JavaVM *javaVM;
 
 void errorHandler(cmsContext ContextID, cmsUInt32Number errorCode,

@@ -584,18 +585,22 @@
     void* inputBuffer;
     void* outputBuffer;
     char* inputRow;
     char* outputRow;
     jobject srcData, dstData;
+    jboolean srcAtOnce = JNI_FALSE, dstAtOnce = JNI_FALSE;
 
     srcOffset = (*env)->GetIntField (env, src, IL_offset_fID);
     srcNextRowOffset = (*env)->GetIntField (env, src, IL_nextRowOffset_fID);
     dstOffset = (*env)->GetIntField (env, dst, IL_offset_fID);
     dstNextRowOffset = (*env)->GetIntField (env, dst, IL_nextRowOffset_fID);
     width = (*env)->GetIntField (env, src, IL_width_fID);
     height = (*env)->GetIntField (env, src, IL_height_fID);
 
+    srcAtOnce = (*env)->GetBooleanField(env, src, IL_imageAtOnce_fID);
+    dstAtOnce = (*env)->GetBooleanField(env, dst, IL_imageAtOnce_fID);
+
     sTrans.j = (*env)->GetLongField (env, trans, Trans_ID_fID);
 
     if (sTrans.xf == NULL) {
         J2dRlsTraceLn(J2D_TRACE_ERROR, "LCMS_colorConvert: transform == NULL");
         JNU_ThrowByName(env, "java/awt/color/CMMException",

@@ -623,15 +628,19 @@
     }
 
     inputRow = (char*)inputBuffer + srcOffset;
     outputRow = (char*)outputBuffer + dstOffset;
 
+    if (srcAtOnce && dstAtOnce) {
+        cmsDoTransform(sTrans.xf, inputRow, outputRow, width * height);
+    } else {
     for (i = 0; i < height; i++) {
         cmsDoTransform(sTrans.xf, inputRow, outputRow, width);
         inputRow += srcNextRowOffset;
         outputRow += dstNextRowOffset;
     }
+    }
 
     releaseILData(env, inputBuffer, srcDType, srcData);
     releaseILData(env, outputBuffer, dstDType, dstData);
 }
 

@@ -668,10 +677,11 @@
     IL_dataArray_fID = (*env)->GetFieldID(env, IL, "dataArray",
                                           "Ljava/lang/Object;");
     IL_width_fID = (*env)->GetFieldID (env, IL, "width", "I");
     IL_height_fID = (*env)->GetFieldID (env, IL, "height", "I");
     IL_offset_fID = (*env)->GetFieldID (env, IL, "offset", "I");
+    IL_imageAtOnce_fID = (*env)->GetFieldID (env, IL, "imageAtOnce", "Z");
     IL_nextRowOffset_fID = (*env)->GetFieldID (env, IL, "nextRowOffset", "I");
 
     PF_ID_fID = (*env)->GetFieldID (env, Pf, "ID", "J");
 }