]> git.saurik.com Git - wxWidgets.git/commitdiff
add automatic rescaling to wxArtProvider
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 24 Mar 2002 00:22:33 +0000 (00:22 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 24 Mar 2002 00:22:33 +0000 (00:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14753 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/artprov.cpp

index 1c18b538ca93d0e1beac7fc89548bd302c612c65..27a7d54d90a88defa2977e73cf78869c040b137a 100644 (file)
@@ -32,6 +32,7 @@
 #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;
@@ -168,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);
     }