Changeset 3272


Ignore:
Timestamp:
10/12/07 13:04:02 (12 years ago)
Author:
melissa
Message:

More tiling/BigTIFF fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/TiffTools.java

    r3270 r3272  
    541541        // the second the denominator 
    542542        long pointer = bigTiff ? in.readLong() : in.readInt(); 
    543         in.seek(pointer); 
     543        if (count > threshhold / 8) in.seek(pointer); 
    544544        if (count == 1) value = new TiffRational(in.readInt(), in.readInt()); 
    545545        else { 
     
    12961296      long tileLength = getIFDLongValue(ifd, TILE_LENGTH, true, 0); 
    12971297 
    1298       byte[] data = new byte[(int) stripByteCounts[0] * stripOffsets.length]; 
     1298      byte[] data = new byte[(int) (imageWidth * imageLength * 
     1299        samplesPerPixel * (bitsPerSample[0] / 8))]; 
    12991300 
    13001301      int row = 0; 
     
    13101311        b = uncompress(b, compression); 
    13111312 
    1312         int ext = (int) (stripByteCounts[0] / (tileWidth * tileLength)); 
     1313        int ext = (int) (b.length / (tileWidth * tileLength)); 
    13131314        int rowBytes = (int) (tileWidth * ext); 
    13141315        if (tileWidth + col > imageWidth) { 
     
    13171318 
    13181319        for (int j=0; j<tileLength; j++) { 
    1319           System.arraycopy(b, rowBytes*j, data, 
    1320             (int) ((row + j)*imageWidth*ext + ext*col), rowBytes); 
     1320          if (row + j < imageLength) { 
     1321            System.arraycopy(b, rowBytes*j, data, 
     1322              (int) ((row + j)*imageWidth*ext + ext*col), rowBytes); 
     1323          } 
     1324          else break; 
    13211325        } 
    13221326 
Note: See TracChangeset for help on using the changeset viewer.