changeset 5982:f602974a14c3

8011992: java/awt/image/mlib/MlibOpsTest.java failed since jdk7u25b05 Reviewed-by: prr, vadim
author bae
date Fri, 12 Apr 2013 14:15:17 +0400
parents 5748526c96f0
children d59dc08047fd
files src/share/native/sun/awt/medialib/awt_ImagingLib.c test/java/awt/image/mlib/MlibOpsTest.java
diffstat 2 files changed, 21 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/awt/medialib/awt_ImagingLib.c	Wed Apr 10 12:51:58 2013 -0700
+++ b/src/share/native/sun/awt/medialib/awt_ImagingLib.c	Fri Apr 12 14:15:17 2013 +0400
@@ -1298,29 +1298,39 @@
         return 0;
     }
 
-    lut_nbands = (*env)->GetArrayLength(env, jtableArrays);
-
-    ncomponents = srcImageP->cmodel.isDefaultCompatCM
-        ? 4
-        : srcImageP->cmodel.numComponents;
-
-    if (lut_nbands > ncomponents) {
-        lut_nbands = ncomponents;
+    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 < ncomponents; i++) {
+    for (i = 0; i < nbands; i++) {
         int idx = srcImageP->hints.colorOrder[i];
 
-        if (idx < 0 || idx >= ncomponents) {
+        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
+        ? 4
+        : srcImageP->cmodel.numComponents;
+
+    if (lut_nbands > ncomponents) {
+        lut_nbands = ncomponents;
+    }
+
     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/test/java/awt/image/mlib/MlibOpsTest.java	Wed Apr 10 12:51:58 2013 -0700
+++ b/test/java/awt/image/mlib/MlibOpsTest.java	Fri Apr 12 14:15:17 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