Changeset 7429


Ignore:
Timestamp:
12/16/10 17:15:18 (9 years ago)
Author:
melissa
Message:

Adjust the number of padding bytes based upon the total number of bytes that could be used for pixel data. Closes #610.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/AVIReader.java

    r7351 r7429  
    130130 
    131131    long fileOff = offsets.get(no).longValue(); 
     132    long end = no < offsets.size() - 1 ? offsets.get(no + 1) : in.length(); 
     133    long maxBytes = end - fileOff; 
    132134    in.seek(fileOff); 
    133135 
     
    167169    } 
    168170 
    169     int pad = (bmpScanLineSize / getRGBChannelCount()) - getSizeX()*bytes; 
     171    int pad = (bmpScanLineSize / getRGBChannelCount()) - getSizeX() * bytes; 
    170172    int scanline = w * bytes * (isInterleaved() ? getRGBChannelCount() : 1); 
    171173 
     
    188190    else { 
    189191      int skip = FormatTools.getPlaneSize(this, getSizeX() - w - x + pad, 1); 
     192      if ((getSizeX() + pad) * getSizeY() * getRGBChannelCount() > maxBytes) { 
     193        skip /= getRGBChannelCount(); 
     194      } 
    190195      for (int i=h - 1; i>=0; i--) { 
    191196        in.skipBytes(x * (bmpBitsPerPixel / 8)); 
Note: See TracChangeset for help on using the changeset viewer.