]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/artprov.cpp
Implemented two-window approach for wxX11.
[wxWidgets.git] / src / common / artprov.cpp
index 7294febe6f51d57dc609daf0282c23de74239b4b..27a7d54d90a88defa2977e73cf78869c040b137a 100644 (file)
 #include "wx/artprov.h"
 #include "wx/hashmap.h"
 #include "wx/module.h"
+#include "wx/image.h"
 
+// For the purposes of forcing this module to link
+extern char g_ArtProviderModule;
 
 // ===========================================================================
 // implementation
@@ -81,6 +84,9 @@ bool wxArtProviderCache::GetBitmap(const wxString& full_id, wxBitmap* bmp)
 
 void wxArtProviderCache::Clear()
 {
+    // Hack to make the default provider link
+    // with the application
+    g_ArtProviderModule = 0;
     m_bitmapsHash.clear();
 }
 
@@ -163,8 +169,18 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL;
         {
             bmp = node->GetData()->CreateBitmap(id, client, size);
             if ( bmp.Ok() )
+            {
+                if ( size != wxDefaultSize && 
+                     (bmp.GetWidth() != size.x || bmp.GetHeight() != size.y) )
+                {
+                    wxImage img = bmp.ConvertToImage();
+                    img.Rescale(size.x, size.y);
+                    bmp = wxBitmap(img);
+                }
                 break;
+            }
         }
+
         sm_cache->PutBitmap(hashId, bmp);
     }