Changeset 213:36f5cb12e1a2 for dwt/graphics/ImageData.d
- Timestamp:
- 05/17/08 11:34:28 (8 months ago)
- Files:
-
- dwt/graphics/ImageData.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/graphics/ImageData.d
r212 r213 291 291 * @exception IllegalArgumentException <ul> 292 292 * <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> 294 294 * <li>ERROR_NULL_ARGUMENT - if the palette or data is null</li> 295 295 * <li>ERROR_CANNOT_BE_ZERO - if the scanlinePad is zero</li> … … 446 446 int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1)) 447 447 / 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 } 448 459 setAllFields( 449 460 width,
