]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/serialize/sergdi.cpp
compilation fix
[wxWidgets.git] / utils / serialize / sergdi.cpp
index 8ab44d782c7df4a1943fd4af607b61a32a526d57..e413a4627b2ef311d7ebc94a8902ce26f3401704 100644 (file)
 #include <wx/colour.h>
 #include <wx/palette.h>
 #include <wx/dcmemory.h>
+#include <wx/log.h>
 #include "sergdi.h"
 
 IMPLEMENT_SERIAL_CLASS(wxBitmap, wxObject)
 IMPLEMENT_SERIAL_CLASS(wxGDIObject, wxObject)
 IMPLEMENT_SERIAL_CLASS(wxRegion, wxGDIObject)
-IMPLEMENT_SERIAL_CLASS(wxColour, wxGDIObject)
+IMPLEMENT_SERIAL_CLASS(wxColour, wxObject)
 IMPLEMENT_SERIAL_CLASS(wxFont, wxGDIObject)
 IMPLEMENT_SERIAL_CLASS(wxPen, wxGDIObject)
 IMPLEMENT_SERIAL_CLASS(wxBrush, wxGDIObject)
@@ -89,7 +90,8 @@ void WXSERIAL(wxBitmap)::LoadObject(wxObjectInputStream& s)
   w = data_s.Read16();
   h = data_s.Read16();
 
-  bitmap->Resize(w, h);
+  bitmap->SetWidth(w);
+  bitmap->SetHeight(h);
   dc.SelectObject(*bitmap);
 
   for (y=0;y<h;y++)
@@ -161,14 +163,20 @@ void WXSERIAL(wxRegion)::LoadObject(wxObjectInputStream& s)
 
 void WXSERIAL(wxColour)::StoreObject(wxObjectOutputStream& s)
 {
-  WXSERIAL(wxGDIObject)::StoreObject(s);
-
   if (s.FirstStage())
     return;
 
   wxDataOutputStream data_s(s);
   wxColour *colour = (wxColour *)Object();
 
+  if (!colour->Ok()) {
+    data_s.Write8(0);
+    data_s.Write8(0);
+    data_s.Write8(0);
+    wxLogDebug("wxColour (0x%x) isn't ready.\n", colour);
+    return;
+  }
+
   data_s.Write8(colour->Red());
   data_s.Write8(colour->Green());
   data_s.Write8(colour->Blue());
@@ -176,8 +184,6 @@ void WXSERIAL(wxColour)::StoreObject(wxObjectOutputStream& s)
 
 void WXSERIAL(wxColour)::LoadObject(wxObjectInputStream& s)
 {
-  WXSERIAL(wxGDIObject)::LoadObject(s);
-  
   wxDataInputStream data_s(s);
   wxColour *colour = (wxColour *)Object();
   int r, g, b;
@@ -305,8 +311,10 @@ void WXSERIAL(wxImageList)::StoreObject(wxObjectOutputStream& s)
   int i;
 
   if (s.FirstStage()) {
+#ifdef __WXGTK__
     for (i=0;i<list->GetImageCount();i++)
       s.AddChild(list->GetBitmap(i));
+#endif
   }
 
   wxDataOutputStream data_s(s);