]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagpng.cpp
Spelling fixes [#1017001], source cleaning.
[wxWidgets.git] / src / common / imagpng.cpp
index 250fac506acf6d28c269c35c0d0d6689b403ef6b..3bf12e257d0f06028cfe0301a179bd1bf60ed33c 100644 (file)
@@ -570,7 +570,7 @@ wxPNGHandler::LoadFile(wxImage *image,
         png_set_expand( png_ptr );
     png_set_filler( png_ptr, 0xff, PNG_FILLER_AFTER );
 
-    image->Create( (int)width, (int)height );
+    image->Create((int)width, (int)height, false /* no need to init pixels */);
 
     if (!image->Ok())
         goto error;
@@ -700,7 +700,11 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
             data[(x << 2) + 0] = *ptr++;
             data[(x << 2) + 1] = *ptr++;
             data[(x << 2) + 2] = *ptr++;
-            if (( !image->HasMask() ) || \
+            if ( image->HasAlpha() )
+            {
+                data[(x << 2) + 3] = image->GetAlpha(x, y);
+            }
+            else if (( !image->HasMask() ) || \
                 (data[(x << 2) + 0] != image->GetMaskRed()) || \
                 (data[(x << 2) + 1] != image->GetMaskGreen()) || \
                 (data[(x << 2) + 2] != image->GetMaskBlue()))