]> granicus.if.org Git - imagemagick/blobdiff - coders/dds.c
(no commit message)
[imagemagick] / coders / dds.c
index 1dbc8bcae0d76766a76425c99b704705017f0984..0e358d96726a34e1fab9621717ee6513f4495721 100644 (file)
@@ -17,7 +17,7 @@
 %                                March 2008                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -241,9 +241,8 @@ static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)
   MagickBooleanType
     status,
     cubemap = MagickFalse,
-    volume = MagickFalse,
-    matte;
-  
+    volume = MagickFalse;
+
   CompressionType
     compression;
 
@@ -253,6 +252,9 @@ static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)
   DDSDecoder
     *decoder;
   
+  PixelTrait
+    alpha_trait;
+  
   size_t
     n, num_images;
   
@@ -297,12 +299,12 @@ static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)
       compression = NoCompression;
       if (dds_info.pixelformat.flags & DDPF_ALPHAPIXELS)
         {
-          matte = MagickTrue;
+          alpha_trait = BlendPixelTrait;
           decoder = ReadUncompressedRGBA;
         }
       else
         {
-          matte = MagickTrue;
+          alpha_trait = UndefinedPixelTrait;
           decoder = ReadUncompressedRGB;
         }
     }
@@ -312,7 +314,7 @@ static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)
       {
         case FOURCC_DXT1:
         {
-          matte = MagickFalse;
+          alpha_trait = UndefinedPixelTrait;
           compression = DXT1Compression;
           decoder = ReadDXT1;
           break;
@@ -320,7 +322,7 @@ static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)
         
         case FOURCC_DXT3:
         {
-          matte = MagickTrue;
+          alpha_trait = BlendPixelTrait;
           compression = DXT3Compression;
           decoder = ReadDXT3;
           break;
@@ -328,7 +330,7 @@ static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)
         
         case FOURCC_DXT5:
         {
-          matte = MagickTrue;
+          alpha_trait = BlendPixelTrait;
           compression = DXT5Compression;
           decoder = ReadDXT5;
           break;
@@ -379,7 +381,7 @@ static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)
         image=SyncNextImageInList(image);
       }
     
-    image->matte = matte;
+    image->alpha_trait=alpha_trait;
     image->compression = compression;
     image->columns = dds_info.width;
     image->rows = dds_info.height;
@@ -549,8 +551,8 @@ static MagickBooleanType ReadDXT1(Image *image, DDSInfo *dds_info,
               SetPixelGreen(image,ScaleCharToQuantum(colors.g[code]),q);
               SetPixelBlue(image,ScaleCharToQuantum(colors.b[code]),q);
               SetPixelAlpha(image,ScaleCharToQuantum(colors.a[code]),q);
-              if (colors.a[code] && (image->matte == MagickFalse))
-                image->matte=MagickTrue;  /* Correct matte */
+              if (colors.a[code] && (image->alpha_trait != BlendPixelTrait))
+                image->alpha_trait=BlendPixelTrait;  /* Correct matte */
               q+=GetPixelChannels(image);
             }
         }