// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
-// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/rawbmp.h"
+#include "wx/filename.h"
+
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
else
{
#if wxUSE_IMAGE
- 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);
if (loadimage.IsOk())
{
- *this = loadimage;
+ *this = wxBitmap(loadimage,-1,scale);
return true;
}
#if wxUSE_IMAGE
-wxBitmap::wxBitmap(const wxImage& image, int depth)
+wxBitmap::wxBitmap(const wxImage& image, int depth, double scale)
{
wxCHECK_RET( image.IsOk(), wxT("invalid image") );
wxBitmapRefData* bitmapRefData;
- m_refData = bitmapRefData = new wxBitmapRefData( width , height , depth ) ;
+ m_refData = bitmapRefData = new wxBitmapRefData( width/scale, height/scale, depth, scale) ;
if ( bitmapRefData->IsOk())
{
wxCFRef<CFURLRef> imageURL;
-#if wxOSX_USE_COCOA
if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )
{
imageURL.reset(CFBundleCopyResourceURL(CFBundleGetMainBundle(), resname2x, restype, NULL));
scale = 2.0;
}
-#endif
if ( imageURL.get() == NULL )
{