git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74511
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxBitmap(const wxSize& sz, int depth = -1) { (void)Create(sz, depth); }
// Convert from wxImage:
wxBitmap(const wxSize& sz, int depth = -1) { (void)Create(sz, depth); }
// Convert from wxImage:
- wxBitmap(const wxImage& image, int depth = -1);
+ wxBitmap(const wxImage& image, int depth = -1, double scale = 1.0);
// Convert from wxIcon
wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); }
// Convert from wxIcon
wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); }
+#include "wx/filename.h"
+
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
- wxImage loadimage(filename, type);
+ double scale = 1.0;
+ wxString fname = filename;
+
+ if ( type == wxBITMAP_TYPE_PNG )
+ {
+ if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )
+ {
+ wxFileName fn(filename);
+ fn.MakeAbsolute();
+ fn.SetName(fn.GetName()+"@2x");
+
+ if ( fn.Exists() )
+ {
+ fname = fn.GetFullPath();
+ scale = 2.0;
+ }
+ }
+ }
+
+ wxImage loadimage(fname, type);
+ *this = wxBitmap(loadimage,-1,scale);
-wxBitmap::wxBitmap(const wxImage& image, int depth)
+wxBitmap::wxBitmap(const wxImage& image, int depth, double scale)
{
wxCHECK_RET( image.IsOk(), wxT("invalid image") );
{
wxCHECK_RET( image.IsOk(), wxT("invalid image") );
wxBitmapRefData* bitmapRefData;
wxBitmapRefData* bitmapRefData;
- m_refData = bitmapRefData = new wxBitmapRefData( width , height , depth ) ;
+ m_refData = bitmapRefData = new wxBitmapRefData( width/scale, height/scale, depth, scale) ;
if ( bitmapRefData->IsOk())
{
if ( bitmapRefData->IsOk())
{