Changeset 5976


Ignore:
Timestamp:
03/01/10 09:47:19 (10 years ago)
Author:
melissa
Message:

Fixed QuickTime writer to correctly pad images whose widths are not a multiple of 4.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/out/QTWriter.java

    r5575 r5976  
    214214      created = (int) System.currentTimeMillis(); 
    215215      numWritten = 0; 
    216       numBytes = buf.length; 
     216      numBytes = buf.length + pad * height; 
    217217      byteCountOffset = 8; 
    218218 
     
    234234        in.close(); 
    235235 
    236         numWritten = numBytes / buf.length; 
    237         numBytes += buf.length; 
     236        numWritten = numBytes / (buf.length + pad * height); 
     237        numBytes += (buf.length + pad * height); 
    238238 
    239239        out.seek(byteCountOffset); 
     
    241241 
    242242        for (int i=0; i<numWritten; i++) { 
    243           offsets.add(new Integer(16 + i * buf.length)); 
     243          offsets.add(new Integer(16 + i * (buf.length + pad * height))); 
    244244        } 
    245245 
     
    254254      // update the number of pixel bytes written 
    255255      int planeOffset = numBytes; 
    256       numBytes += buf.length; 
     256      numBytes += (buf.length + pad * height); 
    257257      out.seek(byteCountOffset); 
    258258      DataTools.writeInt(out, numBytes + 8, false); 
     
    285285    } 
    286286 
    287     out.write(buf); 
     287    int rowLen = buf.length / height; 
     288    for (int row=0; row<height; row++) { 
     289      out.write(buf, row * rowLen, rowLen); 
     290      for (int i=0; i<pad; i++) { 
     291        out.writeByte(0); 
     292      } 
     293    } 
     294 
    288295    numWritten++; 
    289296 
Note: See TracChangeset for help on using the changeset viewer.