Show
Ignore:
Timestamp:
10/06/09 12:19:48 (5 months ago)
Author:
cristy
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ImageMagick/trunk/coders/dds.c

    r1 r326  
    129129typedef struct _DDSInfo 
    130130{ 
    131         unsigned long 
    132                 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, 
    138138    ddscaps1, 
    139139    ddscaps2; 
     
    248248 
    249249  DDSInfo 
    250         dds_info; 
     250    dds_info; 
    251251   
    252252  DDSDecoder 
     
    278278  */ 
    279279  if (ReadDDSInfo(image, &dds_info) != MagickTrue) { 
    280           ThrowReaderException(CorruptImageError,"ImproperImageHeader"); 
     280    ThrowReaderException(CorruptImageError,"ImproperImageHeader"); 
    281281  } 
    282282   
     
    409409static MagickBooleanType ReadDDSInfo(Image *image, DDSInfo *dds_info) 
    410410{ 
    411         unsigned long 
     411  unsigned long 
    412412    hdr_size, 
    413413    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); 
    428428  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 */ 
    438438   
    439439  /* Read pixel format structure */ 
     
    450450  dds_info->pixelformat.alpha_bitmask = ReadBlobLSBLong(image); 
    451451   
    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; 
    457457} 
    458458 
     
    502502    j, 
    503503    y; 
    504          
     504   
    505505  PixelPacket 
    506506    *q; 
     
    513513    code; 
    514514   
    515         unsigned short 
     515  unsigned short 
    516516    c0, 
    517517    c1; 
    518          
     518   
    519519  unsigned long 
    520520    bits; 
     
    527527      /* Get 4x4 patch of pixels to write on */ 
    528528      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); 
    530530       
    531531      if (q == (PixelPacket *) NULL)