Fixes and Cleanup

This commit is contained in:
Stefan Csomor
2018-09-10 18:59:17 +02:00
committed by Vadim Zeitlin
parent e7d21f6638
commit 84f68aa764
6 changed files with 160 additions and 119 deletions

View File

@@ -224,9 +224,12 @@ public:
virtual bool CopyFromIcon(const wxIcon& icon) = 0; virtual bool CopyFromIcon(const wxIcon& icon) = 0;
// implementation: // implementation:
#if WXWIN_COMPATIBILITY_3_0
// deprecated
virtual void SetHeight(int height) = 0; virtual void SetHeight(int height) = 0;
virtual void SetWidth(int width) = 0; virtual void SetWidth(int width) = 0;
virtual void SetDepth(int depth) = 0; virtual void SetDepth(int depth) = 0;
#endif
// Format handling // Format handling
static inline wxList& GetHandlers() { return sm_handlers; } static inline wxList& GetHandlers() { return sm_handlers; }

View File

@@ -175,13 +175,11 @@ public:
#if WXWIN_COMPATIBILITY_3_0 #if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies") wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetWidth(int w); void SetWidth(int width);
wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies") wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetHeight(int h); void SetHeight(int height);
wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies") wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetDepth(int d); void SetDepth(int depth);
wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetOk(bool isOk);
#endif #endif
#if wxUSE_PALETTE #if wxUSE_PALETTE

View File

@@ -44,10 +44,14 @@ public:
int GetWidth() const; int GetWidth() const;
int GetHeight() const; int GetHeight() const;
int GetDepth() const; int GetDepth() const;
void SetWidth(int w); #if WXWIN_COMPATIBILITY_3_0
void SetHeight(int h); wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetDepth(int d); void SetWidth(int width);
void SetOk(bool isOk); wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetHeight(int height);
wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetDepth(int depth);
#endif
wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); } wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); }

View File

@@ -24,22 +24,22 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxIcon, wxGDIObject);
#define M_ICONDATA ((wxIconRefData *)m_refData) #define M_ICONDATA ((wxIconRefData *)m_refData)
#define wxOSX_ICON_USE_NSIMAGE wxOSX_BITMAP_NATIVE_ACCESS
#if wxOSX_ICON_USE_NSIMAGE
// implementation based on NSImage
class WXDLLEXPORT wxIconRefData : public wxGDIRefData class WXDLLEXPORT wxIconRefData : public wxGDIRefData
{ {
public: public:
wxIconRefData() { Init(); } wxIconRefData() { Init(); }
#if wxOSX_USE_ICONREF
wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight );
#else
wxIconRefData( WX_NSImage image, int desiredWidth, int desiredHeight ); wxIconRefData( WX_NSImage image, int desiredWidth, int desiredHeight );
#endif wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight );
virtual ~wxIconRefData() { Free(); } virtual ~wxIconRefData() { Free(); }
#if wxOSX_USE_ICONREF
virtual bool IsOk() const wxOVERRIDE { return m_iconRef != NULL; }
#else
virtual bool IsOk() const wxOVERRIDE { return m_nsImage != NULL; } virtual bool IsOk() const wxOVERRIDE { return m_nsImage != NULL; }
#endif
virtual void Free(); virtual void Free();
void SetWidth( int width ) { m_width = width; } void SetWidth( int width ) { m_width = width; }
@@ -48,22 +48,13 @@ public:
int GetWidth() const { return m_width; } int GetWidth() const { return m_width; }
int GetHeight() const { return m_height; } int GetHeight() const { return m_height; }
#if wxOSX_USE_ICONREF
WXHICON GetHICON() const { return (WXHICON) m_iconRef; }
#endif
#if wxOSX_USE_COCOA
WX_NSImage GetNSImage() const; WX_NSImage GetNSImage() const;
#endif
private: private:
void Init(); void Init();
void Create( NSImage* icon, int desiredWidth, int desiredHeight );
NSImage* m_nsImage;
#if wxOSX_USE_ICONREF
IconRef m_iconRef;
#endif
#if wxOSX_USE_COCOA
mutable NSImage* m_nsImage;
#endif
int m_width; int m_width;
int m_height; int m_height;
@@ -71,21 +62,24 @@ private:
wxDECLARE_NO_COPY_CLASS(wxIconRefData); wxDECLARE_NO_COPY_CLASS(wxIconRefData);
}; };
#if wxOSX_USE_ICONREF
wxIconRefData::wxIconRefData( WXHICON icon, int desiredWidth, int desiredHeight )
{
Init();
m_iconRef = (IconRef)( icon ) ;
// Standard sizes
SetWidth( desiredWidth == -1 ? 32 : desiredWidth ) ;
SetHeight( desiredHeight == -1 ? 32 : desiredHeight ) ;
}
#else
wxIconRefData::wxIconRefData( NSImage* icon, int desiredWidth, int desiredHeight ) wxIconRefData::wxIconRefData( NSImage* icon, int desiredWidth, int desiredHeight )
{ {
Init(); Init();
Create(icon, desiredWidth, desiredHeight);
}
wxIconRefData::wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight )
{
Init();
Create(wxOSXGetNSImageFromIconRef(iconref), desiredWidth, desiredHeight);
ReleaseIconRef(iconref);
}
void wxIconRefData::Create( NSImage* icon, int desiredWidth, int desiredHeight )
{
if ( icon ) if ( icon )
{ {
m_nsImage = icon; m_nsImage = icon;
@@ -96,53 +90,113 @@ wxIconRefData::wxIconRefData( NSImage* icon, int desiredWidth, int desiredHeight
SetWidth( desiredWidth == -1 ? 32 : desiredWidth ) ; SetWidth( desiredWidth == -1 ? 32 : desiredWidth ) ;
SetHeight( desiredHeight == -1 ? 32 : desiredHeight ) ; SetHeight( desiredHeight == -1 ? 32 : desiredHeight ) ;
} }
#endif
void wxIconRefData::Init() void wxIconRefData::Init()
{ {
#if wxOSX_USE_ICONREF
m_iconRef = NULL ;
#endif
#if wxOSX_USE_COCOA
m_nsImage = NULL; m_nsImage = NULL;
#endif
m_width = m_width =
m_height = 0; m_height = 0;
} }
void wxIconRefData::Free() void wxIconRefData::Free()
{ {
#if wxOSX_USE_ICONREF if ( m_nsImage )
{
wxMacCocoaRelease(m_nsImage);
}
}
WX_NSImage wxIconRefData::GetNSImage() const
{
wxASSERT( IsOk() );
return m_nsImage;
}
#else // !wxOSX_ICON_USE_NSIMAGE
// implementation based on IconRef
class WXDLLEXPORT wxIconRefData : public wxGDIRefData
{
public:
wxIconRefData() { Init(); }
wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight );
virtual ~wxIconRefData() { Free(); }
virtual bool IsOk() const wxOVERRIDE { return m_iconRef != NULL; }
virtual void Free();
void SetWidth( int width ) { m_width = width; }
void SetHeight( int height ) { m_height = height; }
int GetWidth() const { return m_width; }
int GetHeight() const { return m_height; }
WXHICON GetHICON() const { return (WXHICON) m_iconRef; }
WX_NSImage GetNSImage() const;
private:
void Init();
IconRef m_iconRef;
mutable NSImage* m_nsImage;
int m_width;
int m_height;
// We can (easily) copy m_iconRef so we don't implement the copy ctor.
wxDECLARE_NO_COPY_CLASS(wxIconRefData);
};
wxIconRefData::wxIconRefData( WXHICON icon, int desiredWidth, int desiredHeight )
{
Init();
m_iconRef = (IconRef)( icon ) ;
// Standard sizes
SetWidth( desiredWidth == -1 ? 32 : desiredWidth ) ;
SetHeight( desiredHeight == -1 ? 32 : desiredHeight ) ;
}
void wxIconRefData::Init()
{
m_iconRef = NULL ;
m_nsImage = NULL;
m_width =
m_height = 0;
}
void wxIconRefData::Free()
{
if ( m_iconRef ) if ( m_iconRef )
{ {
ReleaseIconRef( m_iconRef ) ; ReleaseIconRef( m_iconRef ) ;
m_iconRef = NULL ; m_iconRef = NULL ;
} }
#endif
#if wxOSX_USE_COCOA
if ( m_nsImage ) if ( m_nsImage )
{ {
wxMacCocoaRelease(m_nsImage); wxMacCocoaRelease(m_nsImage);
} }
#endif
} }
#if wxOSX_USE_COCOA
WX_NSImage wxIconRefData::GetNSImage() const WX_NSImage wxIconRefData::GetNSImage() const
{ {
wxASSERT( IsOk() ); wxASSERT( IsOk() );
#if wxOSX_USE_ICONREF
if ( m_nsImage == 0 ) if ( m_nsImage == 0 )
{ {
m_nsImage = wxOSXGetNSImageFromIconRef(m_iconRef); m_nsImage = wxOSXGetNSImageFromIconRef(m_iconRef);
CFRetain(m_nsImage); CFRetain(m_nsImage);
} }
#endif
return m_nsImage; return m_nsImage;
} }
#endif #endif
// //
@@ -182,6 +236,13 @@ wxIcon::wxIcon(WXHICON icon, const wxSize& size)
m_refData = new wxIconRefData( icon, size.x, size.y ) ; m_refData = new wxIconRefData( icon, size.x, size.y ) ;
} }
WXHICON wxIcon::GetHICON() const
{
wxASSERT( IsOk() ) ;
return (WXHICON) ((wxIconRefData*)m_refData)->GetHICON() ;
}
#endif #endif
wxIcon::~wxIcon() wxIcon::~wxIcon()
@@ -201,15 +262,6 @@ wxIcon::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const
return new wxIconRefData; return new wxIconRefData;
} }
#if wxOSX_USE_ICONREF
WXHICON wxIcon::GetHICON() const
{
wxASSERT( IsOk() ) ;
return (WXHICON) ((wxIconRefData*)m_refData)->GetHICON() ;
}
#endif
int wxIcon::GetWidth() const int wxIcon::GetWidth() const
{ {
wxCHECK_MSG( IsOk(), -1, wxT("invalid icon") ); wxCHECK_MSG( IsOk(), -1, wxT("invalid icon") );
@@ -229,15 +281,14 @@ int wxIcon::GetDepth() const
return 32; return 32;
} }
#if wxOSX_USE_COCOA
WX_NSImage wxIcon::GetNSImage() const WX_NSImage wxIcon::GetNSImage() const
{ {
wxCHECK_MSG( IsOk(), NULL, wxT("invalid icon") ); wxCHECK_MSG( IsOk(), NULL, wxT("invalid icon") );
return M_ICONDATA->GetNSImage() ; return M_ICONDATA->GetNSImage() ;
} }
#endif
#if WXWIN_COMPATIBILITY_3_0
void wxIcon::SetDepth( int WXUNUSED(depth) ) void wxIcon::SetDepth( int WXUNUSED(depth) )
{ {
} }
@@ -249,6 +300,7 @@ void wxIcon::SetWidth( int WXUNUSED(width) )
void wxIcon::SetHeight( int WXUNUSED(height) ) void wxIcon::SetHeight( int WXUNUSED(height) )
{ {
} }
#endif
// Load an icon based on resource name or filel name // Load an icon based on resource name or filel name
// Return true on success, false otherwise // Return true on success, false otherwise
@@ -279,7 +331,6 @@ bool wxIcon::LoadIconFromSystemResource(const wxString& resourceName, int desire
{ {
UnRef(); UnRef();
#if wxOSX_USE_ICONREF
OSType theId = 0 ; OSType theId = 0 ;
if ( resourceName == wxT("wxICON_INFORMATION") ) if ( resourceName == wxT("wxICON_INFORMATION") )
@@ -368,13 +419,10 @@ bool wxIcon::LoadIconFromSystemResource(const wxString& resourceName, int desire
IconRef iconRef = NULL ; IconRef iconRef = NULL ;
__Verify_noErr(GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef )) ; __Verify_noErr(GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef )) ;
if ( iconRef ) if ( iconRef )
{
m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight ) ; m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight ) ;
return true ;
}
} }
#endif
return false; return IsOk();
} }
// Load an icon of type 'icns' by resource by name // Load an icon of type 'icns' by resource by name
@@ -528,7 +576,9 @@ void wxIcon::CopyFromBitmap( const wxBitmap& bmp )
{ {
UnRef() ; UnRef() ;
#if wxOSX_USE_ICONREF #if wxOSX_ICON_USE_NSIMAGE
m_refData = new wxIconRefData( bmp.GetNSImage() , bmp.GetWidth(), bmp.GetHeight() ) ;
#else
// as the bitmap owns that ref, we have to acquire it as well // as the bitmap owns that ref, we have to acquire it as well
int w = bmp.GetWidth() ; int w = bmp.GetWidth() ;
@@ -544,8 +594,6 @@ void wxIcon::CopyFromBitmap( const wxBitmap& bmp )
{ {
m_refData = new wxIconRefData( (WXHICON) bmp.CreateIconRef() , bmp.GetWidth(), bmp.GetHeight() ) ; m_refData = new wxIconRefData( (WXHICON) bmp.CreateIconRef() , bmp.GetWidth(), bmp.GetHeight() ) ;
} }
#else
m_refData = new wxIconRefData( bmp.GetNSImage() , bmp.GetWidth(), bmp.GetHeight() ) ;
#endif #endif
} }

View File

@@ -60,16 +60,22 @@ public:
virtual bool IsOk() const wxOVERRIDE { return m_ok; } virtual bool IsOk() const wxOVERRIDE { return m_ok; }
void Free(); void Free();
void SetOk( bool isOk) { m_ok = isOk; }
#if wxOSX_BITMAP_NATIVE_ACCESS #if wxOSX_BITMAP_NATIVE_ACCESS
int GetWidth() const { return CGBitmapContextGetWidth(m_hBitmap); } int GetWidth() const
int GetHeight() const { return CGBitmapContextGetHeight(m_hBitmap); } { return CGBitmapContextGetWidth(m_hBitmap); }
int GetDepth() const { return CGBitmapContextGetBitsPerPixel(m_hBitmap); } int GetHeight() const
int GetBytesPerRow() const { return CGBitmapContextGetBytesPerRow(m_hBitmap); } { return CGBitmapContextGetHeight(m_hBitmap); }
bool HasAlpha() const { int GetDepth() const
{ return CGBitmapContextGetBitsPerPixel(m_hBitmap); }
int GetBytesPerRow() const
{ return CGBitmapContextGetBytesPerRow(m_hBitmap); }
bool HasAlpha() const
{
CGImageAlphaInfo alpha = CGBitmapContextGetAlphaInfo(m_hBitmap); CGImageAlphaInfo alpha = CGBitmapContextGetAlphaInfo(m_hBitmap);
return !( alpha == kCGImageAlphaNone || alpha == kCGImageAlphaNoneSkipFirst || alpha == kCGImageAlphaNoneSkipLast) ; return !(alpha == kCGImageAlphaNone ||
alpha == kCGImageAlphaNoneSkipFirst ||
alpha == kCGImageAlphaNoneSkipLast);
} }
#else #else
void SetWidth( int width ) { m_width = width; } void SetWidth( int width ) { m_width = width; }
@@ -109,12 +115,10 @@ public:
// rescaled to 16 x 16 // rescaled to 16 x 16
bool HasNativeSize(); bool HasNativeSize();
#ifndef __WXOSX_IPHONE__
#if wxOSX_USE_ICONREF #if wxOSX_USE_ICONREF
// caller should increase ref count if needed longer // caller should increase ref count if needed longer
// than the bitmap exists // than the bitmap exists
IconRef GetIconRef(); IconRef GetIconRef();
#endif
#endif #endif
CGContextRef GetBitmapContext() const; CGContextRef GetBitmapContext() const;
@@ -127,6 +131,7 @@ private :
bool Create( CGImageRef image, double scale ); bool Create( CGImageRef image, double scale );
bool Create( CGContextRef bitmapcontext); bool Create( CGContextRef bitmapcontext);
void Init(); void Init();
void FreeDerivedRepresentations();
#if !wxOSX_BITMAP_NATIVE_ACCESS #if !wxOSX_BITMAP_NATIVE_ACCESS
int m_width; int m_width;
@@ -141,10 +146,8 @@ private :
mutable CGImageRef m_cgImageRef; mutable CGImageRef m_cgImageRef;
bool m_isTemplate; bool m_isTemplate;
#ifndef __WXOSX_IPHONE__
#if wxOSX_USE_ICONREF #if wxOSX_USE_ICONREF
IconRef m_iconRef; IconRef m_iconRef;
#endif
#endif #endif
wxCFRef<CGContextRef> m_hBitmap; wxCFRef<CGContextRef> m_hBitmap;
@@ -190,10 +193,8 @@ void wxBitmapRefData::Init()
m_cgImageRef = NULL ; m_cgImageRef = NULL ;
m_isTemplate = false; m_isTemplate = false;
#ifndef __WXOSX_IPHONE__
#if wxOSX_USE_ICONREF #if wxOSX_USE_ICONREF
m_iconRef = NULL ; m_iconRef = NULL ;
#endif
#endif #endif
m_hBitmap = NULL ; m_hBitmap = NULL ;
@@ -391,7 +392,7 @@ void wxBitmapRefData::UseAlpha( bool use )
#endif #endif
wxASSERT_MSG( hBitmap , wxT("Unable to create CGBitmapContext context") ) ; wxASSERT_MSG( hBitmap , wxT("Unable to create CGBitmapContext context") ) ;
CGContextTranslateCTM( hBitmap, 0, GetHeight() ); CGContextTranslateCTM( hBitmap, 0, GetHeight() );
CGContextScaleCTM( hBitmap, 1*GetScaleFactor(), -1*GetScaleFactor() ); CGContextScaleCTM( hBitmap, GetScaleFactor(), -GetScaleFactor() );
m_hBitmap.reset(hBitmap); m_hBitmap.reset(hBitmap);
} }
@@ -408,13 +409,7 @@ const void *wxBitmapRefData::GetRawAccess() const
void *wxBitmapRefData::GetRawAccess() void *wxBitmapRefData::GetRawAccess()
{ {
wxCHECK_MSG( IsOk(), NULL , wxT("invalid bitmap") ) ; return const_cast<void*>(const_cast<const wxBitmapRefData*>(this)->GetRawAccess());
wxASSERT_MSG( m_rawAccessCount == 1, "Direct write access must be within Begin/EndRawAccess" ) ;
#if !wxOSX_BITMAP_NATIVE_ACCESS
return m_memBuf.GetData() ;
#else
return CGBitmapContextGetData(m_hBitmap);
#endif
} }
@@ -422,21 +417,17 @@ void *wxBitmapRefData::BeginRawAccess()
{ {
wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ) ; wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ) ;
wxASSERT( m_rawAccessCount == 0 ) ; wxASSERT( m_rawAccessCount == 0 ) ;
#ifndef __WXOSX_IPHONE__
#if wxOSX_USE_ICONREF #if wxOSX_USE_ICONREF
wxASSERT_MSG( m_iconRef == NULL , wxASSERT_MSG( m_iconRef == NULL ,
wxT("Currently, modifing bitmaps that are used in controls already is not supported") ) ; wxT("Currently, modifing bitmaps that are used in controls already is not supported") ) ;
#endif #endif
#endif
++m_rawAccessCount ; ++m_rawAccessCount ;
// we must destroy an existing cached image, as // we must destroy an existing cached image, as
// the bitmap data may change now // the bitmap data may change now
if ( m_cgImageRef ) FreeDerivedRepresentations();
{
CGImageRelease( m_cgImageRef ) ;
m_cgImageRef = NULL ;
}
return GetRawAccess() ; return GetRawAccess() ;
} }
@@ -458,7 +449,6 @@ bool wxBitmapRefData::HasNativeSize()
return ( sz == 128 || sz == 48 || sz == 32 || sz == 16 ); return ( sz == 128 || sz == 48 || sz == 32 || sz == 16 );
} }
#ifndef __WXOSX_IPHONE__
#if wxOSX_USE_ICONREF #if wxOSX_USE_ICONREF
IconRef wxBitmapRefData::GetIconRef() IconRef wxBitmapRefData::GetIconRef()
{ {
@@ -671,8 +661,7 @@ IconRef wxBitmapRefData::GetIconRef()
return m_iconRef ; return m_iconRef ;
} }
#endif #endif // wxOSX_USE_ICONREF
#endif
CGImageRef wxBitmapRefData::CreateCGImage() const CGImageRef wxBitmapRefData::CreateCGImage() const
{ {
@@ -821,25 +810,28 @@ wxDC *wxBitmapRefData::GetSelectedInto() const
return m_selectedInto; return m_selectedInto;
} }
void wxBitmapRefData::FreeDerivedRepresentations()
void wxBitmapRefData::Free()
{ {
wxASSERT_MSG( m_rawAccessCount == 0 , wxT("Bitmap still selected when destroyed") ) ;
if ( m_cgImageRef ) if ( m_cgImageRef )
{ {
CGImageRelease( m_cgImageRef ) ; CGImageRelease( m_cgImageRef ) ;
m_cgImageRef = NULL ; m_cgImageRef = NULL ;
} }
#ifndef __WXOSX_IPHONE__
#if wxOSX_USE_ICONREF #if wxOSX_USE_ICONREF
if ( m_iconRef ) if ( m_iconRef )
{ {
ReleaseIconRef( m_iconRef ) ; ReleaseIconRef( m_iconRef ) ;
m_iconRef = NULL ; m_iconRef = NULL ;
} }
#endif #endif // wxOSX_USE_ICONREF
#endif }
void wxBitmapRefData::Free()
{
wxASSERT_MSG( m_rawAccessCount == 0 , wxT("Bitmap still selected when destroyed") ) ;
FreeDerivedRepresentations();
m_hBitmap.reset(); m_hBitmap.reset();
wxDELETE(m_bitmapMask); wxDELETE(m_bitmapMask);
} }
@@ -1479,6 +1471,7 @@ bool wxBitmap::HasAlpha() const
return GetBitmapData()->HasAlpha() ; return GetBitmapData()->HasAlpha() ;
} }
#if WXWIN_COMPATIBILITY_3_0
void wxBitmap::SetWidth(int w) void wxBitmap::SetWidth(int w)
{ {
AllocExclusive(); AllocExclusive();
@@ -1496,12 +1489,7 @@ void wxBitmap::SetDepth(int d)
AllocExclusive(); AllocExclusive();
wxASSERT_MSG( d == -1 || GetDepth() == d, "Changing the bitmap depth is not supported"); wxASSERT_MSG( d == -1 || GetDepth() == d, "Changing the bitmap depth is not supported");
} }
#endif
void wxBitmap::SetOk(bool isOk)
{
AllocExclusive();
GetBitmapData()->SetOk(isOk);
}
#if wxUSE_PALETTE #if wxUSE_PALETTE
wxPalette *wxBitmap::GetPalette() const wxPalette *wxBitmap::GetPalette() const

View File

@@ -74,7 +74,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
{ {
wxASSERT_MSG( !bitmap.GetSelectedInto() || wxASSERT_MSG( !bitmap.GetSelectedInto() ||
(bitmap.GetSelectedInto() == GetOwner()), (bitmap.GetSelectedInto() == GetOwner()),
wxT("Bitmap is selected in another wxMemoryDC, delete the first wxMemoryDC or use SelectObject(NULL)") ); "Bitmap is selected in another wxMemoryDC, delete the first wxMemoryDC or use SelectObject(NULL)" );
m_selected.SetSelectedInto(GetOwner()); m_selected.SetSelectedInto(GetOwner());
m_width = bitmap.GetScaledWidth(); m_width = bitmap.GetScaledWidth();