add automatic rescaling to wxArtProvider
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14753 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3a6d3fdd64
commit
3242feb1c0
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user