Show
Ignore:
Timestamp:
05/17/08 11:34:28 (8 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Update to SWT 3.4M7

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/graphics/ImageData.d

    r212 r213  
    291291 * @exception IllegalArgumentException <ul> 
    292292 *    <li>ERROR_INVALID_ARGUMENT - if the width or height is negative, or if the depth is not 
    293  *          one of 1, 2, 4, 8, 16, 24 or 32</li> 
     293 *          one of 1, 2, 4, 8, 16, 24 or 32, or the data array is too small to contain the image data</li> 
    294294 *    <li>ERROR_NULL_ARGUMENT - if the palette or data is null</li> 
    295295 *    <li>ERROR_CANNOT_BE_ZERO - if the scanlinePad is zero</li> 
     
    446446    int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1)) 
    447447        / scanlinePad * scanlinePad; 
     448     
     449    /* 
     450     * When the image is being loaded from a PNG, we need to use the theoretical minimum 
     451     * number of bytes per line to check whether there is enough data, because the actual 
     452     * number of bytes per line is calculated based on the given depth, which may be larger 
     453     * than the actual depth of the PNG. 
     454     */ 
     455    int minBytesPerLine = type is DWT.IMAGE_PNG ? ((((width + 7) / 8) + 3) / 4) * 4 : bytesPerLine; 
     456    if (data !is null && data.length < minBytesPerLine * height) { 
     457        DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
     458    } 
    448459    setAllFields( 
    449460        width,