8011992: java/awt/image/mlib/MlibOpsTest.java failed since jdk7u25b05
authorbae
Fri, 12 Apr 2013 14:08:21 +0400
changeset 18229 7f925606ad70
parent 18228 f14a008f78be
child 18230 49355d383f41
8011992: java/awt/image/mlib/MlibOpsTest.java failed since jdk7u25b05 Reviewed-by: vadim
jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c
jdk/test/java/awt/image/mlib/MlibOpsTest.java
--- a/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c	Wed Apr 10 15:55:07 2013 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c	Fri Apr 12 14:08:21 2013 +0400
@@ -1298,6 +1298,29 @@
         return 0;
     }
 
+    nbands = setImageHints(env, srcImageP, dstImageP, FALSE, TRUE,
+                        FALSE, &hint);
+
+    if (nbands < 1 || nbands > srcImageP->cmodel.numComponents) {
+        /* Can't handle any custom images */
+        awt_freeParsedImage(srcImageP, TRUE);
+        awt_freeParsedImage(dstImageP, TRUE);
+        return 0;
+    }
+
+    /* Make sure that color order can be used for
+     * re-ordering of lookup arrays.
+     */
+    for (i = 0; i < nbands; i++) {
+        int idx = srcImageP->hints.colorOrder[i];
+
+        if (idx < 0 || idx >= nbands) {
+            awt_freeParsedImage(srcImageP, TRUE);
+            awt_freeParsedImage(dstImageP, TRUE);
+            return 0;
+        }
+    }
+
     lut_nbands = (*env)->GetArrayLength(env, jtableArrays);
 
     ncomponents = srcImageP->cmodel.isDefaultCompatCM
@@ -1308,19 +1331,6 @@
         lut_nbands = ncomponents;
     }
 
-    /* Make sure that color order can be used for
-     * re-ordering of lookup arrays.
-     */
-    for (i = 0; i < ncomponents; i++) {
-        int idx = srcImageP->hints.colorOrder[i];
-
-        if (idx < 0 || idx >= ncomponents) {
-            awt_freeParsedImage(srcImageP, TRUE);
-            awt_freeParsedImage(dstImageP, TRUE);
-            return 0;
-        }
-    }
-
     tbl = NULL;
     if (SAFE_TO_ALLOC_2(ncomponents, sizeof(unsigned char *))) {
         tbl = (unsigned char **)
@@ -1363,17 +1373,6 @@
         }
     }
 
-    nbands = setImageHints(env, srcImageP, dstImageP, FALSE, TRUE,
-                        FALSE, &hint);
-    if (nbands < 1) {
-        /* Can't handle any custom images */
-        free(tbl);
-        free(jtable);
-        awt_freeParsedImage(srcImageP, TRUE);
-        awt_freeParsedImage(dstImageP, TRUE);
-        return 0;
-    }
-
     /* Allocate the arrays */
     if (allocateArray(env, srcImageP, &src, &sdata, TRUE, FALSE, FALSE) < 0) {
         /* Must be some problem */
--- a/jdk/test/java/awt/image/mlib/MlibOpsTest.java	Wed Apr 10 15:55:07 2013 +0400
+++ b/jdk/test/java/awt/image/mlib/MlibOpsTest.java	Fri Apr 12 14:08:21 2013 +0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     6556332
+ * @bug     6556332 8011992
  * @summary Test verifies that on-demnad loading of medialib library does
  *          not break imageing ops based on this library.
  * @run     main MlibOpsTest