< prev index next >

modules/javafx.graphics/src/main/java/com/sun/marlin/MaskMarlinAlphaConsumer.java

Print this page

        

@@ -246,10 +246,12 @@
         final int _BLK_SIZE_LG  = MarlinConst.BLOCK_SIZE_LG;
 
         // traverse flagged blocks:
         final int blkW = (from >> _BLK_SIZE_LG);
         final int blkE = (ato   >> _BLK_SIZE_LG) + 1;
+        // ensure last block flag = 0 to process final block:
+        blkFlags[blkE] = 0;
 
         // Perform run-length encoding and store results in the piscesCache
         int curAlpha = 0;
 
         final int _MAX_VALUE = Integer.MAX_VALUE;

@@ -288,11 +290,10 @@
                                 // skip alpha = 0
                                 if (curAlpha == 0) {
                                     i = cx;
                                 } else {
                                     val = _unsafe.getByte(addr_alpha + curAlpha);
-
                                     do {
                                         out[off + i] = val;
                                         i++;
                                     } while (i < cx);
                                 }

@@ -304,16 +305,17 @@
                     }
                 }
             }
 
             // Process remaining span:
-            val = _unsafe.getByte(addr_alpha + curAlpha);
-
-            do {
-                out[off + i] = val;
-                i++;
-            } while (i < ato);
+            if (curAlpha != 0) {
+                val = _unsafe.getByte(addr_alpha + curAlpha);
+                while (i < ato) {
+                    out[off + i] = val;
+                    i++;
+                }
+            }
 
         } else {
             int i = 0;
 
             while (i < from) {

@@ -343,11 +345,10 @@
                             alphaDeltas[cx] = 0;
 
                             // fill span:
                             if (cx != i) {
                                 val = _unsafe.getByte(addr_alpha + curAlpha);
-
                                 do {
                                     out[off + i] = val;
                                     i++;
                                 } while (i < cx);
                             }

@@ -358,16 +359,17 @@
                     }
                 }
             }
 
             // Process remaining span:
-            val = _unsafe.getByte(addr_alpha + curAlpha);
-
-            do {
-                out[off + i] = val;
-                i++;
-            } while (i < ato);
+            if (curAlpha != 0) {
+                val = _unsafe.getByte(addr_alpha + curAlpha);
+                while (i < ato) {
+                    out[off + i] = val;
+                    i++;
+                }
+            }
 
             while (i < w) {
                 out[off + i] = 0;
                 i++;
             }
< prev index next >