You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2009/07/20 10:33:32 UTC

svn commit: r795717 - /harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/PngDecoder.java

Author: hindessm
Date: Mon Jul 20 08:33:31 2009
New Revision: 795717

URL: http://svn.apache.org/viewvc?rev=795717&view=rev
Log:
Remove constant variables to make code more readable.

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/PngDecoder.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/PngDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/PngDecoder.java?rev=795717&r1=795716&r2=795717&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/PngDecoder.java (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/PngDecoder.java Mon Jul 20 08:33:31 2009
@@ -107,27 +107,17 @@
     public void decodeImage() throws IOException {
         try {
             int bytesRead = 0;
-            int needBytes, offset, bytesInBuffer = 0;
             // Read from the input stream
             for (;;) {
-                needBytes = buffer_size - bytesInBuffer;
-                offset = bytesInBuffer;
+                bytesRead = inputStream.read(buffer, 0, buffer_size);
 
-                bytesRead = inputStream.read(buffer, offset, needBytes);
-
-                if (bytesRead < 0) { // Break, nothing to read from buffer, image truncated?
+                if (bytesRead < 0) {
+                    // Break, nothing to read from buffer, image truncated?
                     releaseNativeDecoder(hNativeDecoder);
                     break;
                 }
 
-                // Keep track on how much bytes left in buffer
-                bytesInBuffer += bytesRead;
-                hNativeDecoder = decode(buffer, bytesInBuffer, hNativeDecoder);
-                // PNG decoder always consumes all bytes at once
-                bytesInBuffer = 0;
-
-                // if (bytesConsumed < 0)
-                //break; // Error exit
+                hNativeDecoder = decode(buffer, bytesRead, hNativeDecoder);
 
                 returnData();