]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/ole/dataobj.cpp
fixes to refreshing code in wxTreeCtrl
[wxWidgets.git] / src / msw / ole / dataobj.cpp
index 29c0d6f8e52a58371b1260f1042b963cc75bed7f..e816a3d629cc51f368333dd2250e2c71372e68a7 100644 (file)
@@ -685,13 +685,13 @@ void wxDataObject::SetAutoDelete()
     m_pIDataObject = NULL;
 }
 
-size_t wxDataObject::GetBufferOffset( const wxDataFormat& format )
+size_t wxDataObject::GetBufferOffset( const wxDataFormat& WXUNUSED(format) )
 {
     return sizeof(size_t);
 }
 
 const void* wxDataObject::GetSizeFromBuffer( const void* buffer, size_t* size,
-                                             const wxDataFormat& format )
+                                             const wxDataFormat& WXUNUSED(format) )
 {
     size_t* p = (size_t*)buffer;
     *size = *p;
@@ -700,7 +700,7 @@ const void* wxDataObject::GetSizeFromBuffer( const void* buffer, size_t* size,
 }
 
 void* wxDataObject::SetSizeInBuffer( void* buffer, size_t size,
-                                       const wxDataFormat& format )
+                                       const wxDataFormat& WXUNUSED(format) )
 {
     size_t* p = (size_t*)buffer;
     *p = size;
@@ -1070,13 +1070,13 @@ class CFSTR_SHELLURLDataObject:public wxCustomDataObject
 public:
     CFSTR_SHELLURLDataObject() : wxCustomDataObject(CFSTR_SHELLURL) {}
 protected:
-    virtual size_t GetBufferOffset( const wxDataFormat& format )
+    virtual size_t GetBufferOffset( const wxDataFormat& WXUNUSED(format) )
     {
         return 0;
     }
 
     virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size,
-                                           const wxDataFormat& format )
+                                           const wxDataFormat& WXUNUSED(format) )
     {
         // CFSTR_SHELLURL is _always_ ANSI text
         *size = strlen( (const char*)buffer );
@@ -1084,8 +1084,8 @@ protected:
         return buffer;
     }
 
-    virtual void* SetSizeInBuffer( void* buffer, size_t size,
-                                   const wxDataFormat& format )
+    virtual void* SetSizeInBuffer( void* buffer, size_t WXUNUSED(size),
+                                   const wxDataFormat& WXUNUSED(format) )
     {
         return buffer;
     }
@@ -1260,8 +1260,15 @@ wxBitmap wxConvertDIBToBitmap(const LPBITMAPINFO pbmi)
     // BITMAPINFO starts with BITMAPINFOHEADER followed by colour info
     const BITMAPINFOHEADER *pbmih = &pbmi->bmiHeader;
 
+    // biClrUsed has the number of colors, unless it's 0
+    int numColors = pbmih->biClrUsed;
+    if (numColors==0)
+    {
+        numColors = wxGetNumOfBitmapColors(pbmih->biBitCount);
+    }
+
     // offset of image from the beginning of the header
-    DWORD ofs = wxGetNumOfBitmapColors(pbmih->biBitCount) * sizeof(RGBQUAD);
+    DWORD ofs = numColors * sizeof(RGBQUAD);
     void *image = (char *)pbmih + sizeof(BITMAPINFOHEADER) + ofs;
 
     ScreenHDC hdc;