]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/xpmdecod.cpp
[ 1492053 ] Add wxVListBox style callbacks to wxOwnerDrawnComboBox.
[wxWidgets.git] / src / common / xpmdecod.cpp
index 46a7c2486c38ba3efba5d6656d2a2df8dcadef55..ac1b1b7249151f5ce7dd67cc03bff742c2fea99d 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        xpmdecod.cpp
+// Name:        src/common/xpmdecod.cpp
 // Purpose:     wxXPMDecoder
 // Author:      John Cristy, Vaclav Slavik
 // RCS-ID:      $Id$
@@ -94,21 +94,22 @@ license is as follows:
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#  pragma hdrstop
+    #pragma hdrstop
 #endif
 
+#if wxUSE_IMAGE && wxUSE_XPM
+
 #ifndef WX_PRECOMP
-#  include "wx/defs.h"
+    #include "wx/intl.h"
+    #include "wx/log.h"
+    #include "wx/utils.h"
+    #if wxUSE_STREAMS
+        #include "wx/stream.h"
+    #endif
 #endif
 
-#if wxUSE_IMAGE && wxUSE_XPM
-
-#include "wx/stream.h"
 #include "wx/image.h"
-#include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/hashmap.h"
-#include "wx/intl.h"
 #include <string.h>
 
 #include <ctype.h>
@@ -653,6 +654,7 @@ static const char *ParseColor(const char *data)
 
 struct wxXPMColourMapData
 {
+    wxXPMColourMapData() { R = G = B = 0; }
     unsigned char R,G,B;
 };
 WX_DECLARE_STRING_HASH_MAP(wxXPMColourMapData, wxXPMColourMap);
@@ -699,6 +701,7 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data)
     /*
      *  Create colour map:
      */
+    wxXPMColourMapData clr_data;
     for (i = 0; i < colors_cnt; i++)
     {
         const char *xmpColLine = xpm_data[1 + i];
@@ -711,8 +714,6 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data)
             return wxNullImage;
         }
 
-        wxXPMColourMapData clr_data;
-
         for (i_key = 0; i_key < chars_per_pixel; i_key++)
             key[i_key] = (wxChar)xmpColLine[i_key];
         clr_def = ParseColor(xmpColLine + chars_per_pixel);
@@ -737,6 +738,9 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data)
         {
             img.SetMask(true);
             img.SetMaskColour(255, 0, 255);
+            clr_data.R =
+            clr_data.B = 255;
+            clr_data.G = 0;
             hasMask = true;
             maskKey = key;
         }