< prev index next >

src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -1326,18 +1326,19 @@
             System.out.println("maxProgressivePass is " + maxProgressivePass);
             System.out.println("callbackUpdates is " + callbackUpdates);
         }
 
         // Finally, we are ready to read
-
-        processImageStarted(currentImage);
-
         boolean aborted = false;
-
-        // Note that getData disables acceleration on buffer, but it is
-        // just a 1-line intermediate data transfer buffer that will not
-        // affect the acceleration of the resulting image.
+        /*
+         * All the Jpeg processing happens in native, we should clear
+         * abortFlag of imageIODataStruct in imageioJPEG.c. And we need
+         * clear abortFlag because without that consecutive read calls
+         * will become invalid.
+         */
+        clearNativeReadAbortFlag(structPointer);
+        processImageStarted(currentImage);
         aborted = readImage(structPointer,
                             buffer.getData(),
                             numRasterBands,
                             srcBands,
                             bandSizes,

@@ -1511,10 +1512,16 @@
                                      JPEGHuffmanTable [] abbrevACHuffmanTables,
                                      int minProgressivePass,
                                      int maxProgressivePass,
                                      boolean wantUpdates);
 
+    /*
+     * We should call clearNativeReadAbortFlag() before we start reading
+     * jpeg image as image processing happens at native side.
+     */
+    private native void clearNativeReadAbortFlag(long structPointer);
+
     public void abort() {
         setThreadLock();
         try {
             /**
              * NB: we do not check the call back lock here,
< prev index next >