Changeset 326 for ImageMagick/trunk/coders/dds.c
- Timestamp:
- 10/06/09 12:19:48 (5 months ago)
- Files:
-
- 1 modified
-
ImageMagick/trunk/coders/dds.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ImageMagick/trunk/coders/dds.c
r1 r326 129 129 typedef struct _DDSInfo 130 130 { 131 unsigned long132 flags,133 height,134 width,135 pitchOrLinearSize,136 depth,137 mipmapcount,131 unsigned long 132 flags, 133 height, 134 width, 135 pitchOrLinearSize, 136 depth, 137 mipmapcount, 138 138 ddscaps1, 139 139 ddscaps2; … … 248 248 249 249 DDSInfo 250 dds_info;250 dds_info; 251 251 252 252 DDSDecoder … … 278 278 */ 279 279 if (ReadDDSInfo(image, &dds_info) != MagickTrue) { 280 ThrowReaderException(CorruptImageError,"ImproperImageHeader");280 ThrowReaderException(CorruptImageError,"ImproperImageHeader"); 281 281 } 282 282 … … 409 409 static MagickBooleanType ReadDDSInfo(Image *image, DDSInfo *dds_info) 410 410 { 411 unsigned long411 unsigned long 412 412 hdr_size, 413 413 required; 414 415 /* Seek to start of header */416 (void) SeekBlob(image, 4, SEEK_SET);417 418 /* Check header field */419 hdr_size = ReadBlobLSBLong(image);420 if (hdr_size != 124)421 return MagickFalse;422 423 /* Fill in DDS info struct */424 dds_info->flags = ReadBlobLSBLong(image);425 426 /* Check required flags */427 required=(unsigned long) (DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT);414 415 /* Seek to start of header */ 416 (void) SeekBlob(image, 4, SEEK_SET); 417 418 /* Check header field */ 419 hdr_size = ReadBlobLSBLong(image); 420 if (hdr_size != 124) 421 return MagickFalse; 422 423 /* Fill in DDS info struct */ 424 dds_info->flags = ReadBlobLSBLong(image); 425 426 /* Check required flags */ 427 required=(unsigned long) (DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT); 428 428 if ((dds_info->flags & required) != required) 429 return MagickFalse;430 431 dds_info->height = ReadBlobLSBLong(image);432 dds_info->width = ReadBlobLSBLong(image);433 dds_info->pitchOrLinearSize = ReadBlobLSBLong(image);434 dds_info->depth = ReadBlobLSBLong(image);435 dds_info->mipmapcount = ReadBlobLSBLong(image);436 437 (void) SeekBlob(image, 44, SEEK_CUR);/* reserved region of 11 DWORDs */429 return MagickFalse; 430 431 dds_info->height = ReadBlobLSBLong(image); 432 dds_info->width = ReadBlobLSBLong(image); 433 dds_info->pitchOrLinearSize = ReadBlobLSBLong(image); 434 dds_info->depth = ReadBlobLSBLong(image); 435 dds_info->mipmapcount = ReadBlobLSBLong(image); 436 437 (void) SeekBlob(image, 44, SEEK_CUR); /* reserved region of 11 DWORDs */ 438 438 439 439 /* Read pixel format structure */ … … 450 450 dds_info->pixelformat.alpha_bitmask = ReadBlobLSBLong(image); 451 451 452 dds_info->ddscaps1 = ReadBlobLSBLong(image);453 dds_info->ddscaps2 = ReadBlobLSBLong(image);454 (void) SeekBlob(image, 12, SEEK_CUR); /* 3 reserved DWORDs */455 456 return MagickTrue;452 dds_info->ddscaps1 = ReadBlobLSBLong(image); 453 dds_info->ddscaps2 = ReadBlobLSBLong(image); 454 (void) SeekBlob(image, 12, SEEK_CUR); /* 3 reserved DWORDs */ 455 456 return MagickTrue; 457 457 } 458 458 … … 502 502 j, 503 503 y; 504 504 505 505 PixelPacket 506 506 *q; … … 513 513 code; 514 514 515 unsigned short515 unsigned short 516 516 c0, 517 517 c1; 518 518 519 519 unsigned long 520 520 bits; … … 527 527 /* Get 4x4 patch of pixels to write on */ 528 528 q = QueueAuthenticPixels(image, x, y, Min(4, dds_info->width - x), 529 Min(4, dds_info->height - y),exception);529 Min(4, dds_info->height - y),exception); 530 530 531 531 if (q == (PixelPacket *) NULL)
