From a3daed0276256f54a82f4f4c028bc69f66a7b47b Mon Sep 17 00:00:00 2001 From: "Unknown (AN)" Date: Thu, 16 Sep 1999 19:24:01 +0000 Subject: [PATCH] call HasMask() before writing PNG files, as was done in WX_2_0_FIXES git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3686 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/imagpng.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 1815bcb1ba..a2f0c435ed 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -324,15 +324,16 @@ 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 ((data[(x << 2) + 0] == image->GetMaskRed()) && - (data[(x << 2) + 1] == image->GetMaskGreen()) && - (data[(x << 2) + 2] == image->GetMaskBlue())) + if (( !image->HasMask() ) || \ + (data[(x << 2) + 0] != image->GetMaskRed()) || \ + (data[(x << 2) + 1] != image->GetMaskGreen()) || \ + (data[(x << 2) + 2] != image->GetMaskBlue())) { - data[(x << 2) + 3] = 0; + data[(x << 2) + 3] = 255; } else { - data[(x << 2) + 3] = 255; + data[(x << 2) + 3] = 0; } } png_bytep row_ptr = data;