Changeset 7337


Ignore:
Timestamp:
12/06/10 13:57:24 (9 years ago)
Author:
melissa
Message:

Fixed plane size and pixel offset calculations when opening a sub-image.

File:
1 edited

Legend:

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

    r7224 r7337  
    117117    if (pad == 0) pad = ((rowLength * bpp) / 8) % 4; 
    118118    else pad *= getSizeC(); 
    119     int planeSize = getSizeX() * getSizeC() * getSizeY(); 
     119    int planeSize = getSizeX() * getSizeC() * h; 
    120120    if (bpp >= 8) planeSize *= (bpp / 8); 
    121121    else planeSize /= (8 / bpp); 
    122     planeSize += pad * getSizeY(); 
     122    planeSize += pad * h; 
    123123    if (planeSize + in.getFilePointer() > in.length()) { 
    124       planeSize -= (pad * getSizeY()); 
     124      planeSize -= (pad * h); 
    125125      pad = 0; 
    126126    } 
     127 
     128    in.skipBytes(rowsToSkip * pad); 
    127129 
    128130    byte[] rawPlane = new byte[planeSize]; 
Note: See TracChangeset for help on using the changeset viewer.