ensure that the copies of the bitmap passed to wxMemoryDC ctor are not modified when this bitmap is

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55694 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2008-09-17 22:20:38 +00:00
parent 573cdf43af
commit 2a02f84b94

View File

@ -157,9 +157,19 @@ wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner )
return new wxMemoryDCImpl( owner );
}
wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap )
wxDCImpl* wxNativeDCFactory::CreateMemoryDC(wxMemoryDC *owner, wxBitmap& bitmap)
{
return new wxMemoryDCImpl( owner, bitmap );
// the bitmap may be modified when it's selected into a memory DC so make
// sure changing this bitmap doesn't affect any other shallow copies of it
// (see wxMemoryDC::SelectObject())
//
// notice that we don't provide any ctor equivalent to SelectObjectAsSource
// method because this should be rarely needed and easy to work around by
// using the default ctor and calling SelectObjectAsSource itself
if ( bitmap.IsOk() )
bitmap.UnShare();
return new wxMemoryDCImpl(owner, bitmap);
}
wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxDC *dc )