commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1236071 - /commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java
Date Thu, 26 Jan 2012 08:40:20 GMT
Author: damjan
Date: Thu Jan 26 08:40:20 2012
New Revision: 1236071

URL: http://svn.apache.org/viewvc?rev=1236071&view=rev
Log:
rowsPerStrip is meant to be a 32 bit unsigned integer,
since we store it in an int, and real-world TIFF
files use the value 2^32 - 1, it needs to be
promoted to a long when calculating tile height
with it.


Modified:
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java?rev=1236071&r1=1236070&r2=1236071&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java
Thu Jan 26 08:40:20 2012
@@ -85,17 +85,18 @@ public final class DataReaderStrips exte
     {
         for (int strip = 0; strip < imageData.strips.length; strip++)
         {
-            int rowsRemaining = height - (strip * rowsPerStrip);
-            int rowsInThisStrip = Math.min(rowsRemaining, rowsPerStrip);
-            int pixelsPerStrip = rowsInThisStrip * width;
-            int bytesPerStrip = ((pixelsPerStrip * bitsPerPixel) + 7) / 8;
+            long rowsPerStripLong = 0xFFFFffffL & rowsPerStrip;
+            long rowsRemaining = height - (strip * rowsPerStripLong);
+            long rowsInThisStrip = Math.min(rowsRemaining, rowsPerStripLong);
+            long pixelsPerStrip = rowsInThisStrip * width;
+            long bytesPerStrip = ((pixelsPerStrip * bitsPerPixel) + 7) / 8;
 
             byte compressed[] = imageData.strips[strip].data;
 
             byte decompressed[] = decompress(compressed, compression,
-                    bytesPerStrip, width, rowsInThisStrip);
+                    (int)bytesPerStrip, width, (int)rowsInThisStrip);
 
-            interpretStrip(bi, decompressed, pixelsPerStrip);
+            interpretStrip(bi, decompressed, (int)pixelsPerStrip);
 
         }
     }



Mime
View raw message