Update NSImage with changes made to bitmap pixel data
In order to get access to wxBitmap's pixel data we actually have to work with CGBitmapContext data and this context is created from NSImage by call to wxBitmapRefData::EnsureBitmapExists() when we prepare to get access to the data in wxBitmapRefData::GetRawAccess(). So, when we finish updating bitmap data we should update original NSImage with actual CGBitmapContext data in wxBitmapRefData::EndRawAccess(). See #18606.
This commit is contained in:
@@ -419,6 +419,15 @@ void wxBitmapRefData::EndRawAccess()
|
||||
wxASSERT( m_rawAccessCount == 1 ) ;
|
||||
|
||||
--m_rawAccessCount ;
|
||||
|
||||
// Update existing NSImage with new bitmap data
|
||||
if ( m_nsImage )
|
||||
{
|
||||
wxCFRef<CGImageRef> image(CGBitmapContextCreateImage(m_hBitmap));
|
||||
wxMacCocoaRelease(m_nsImage);
|
||||
m_nsImage = wxOSXGetImageFromCGImage(image, GetScaleFactor(), IsTemplate());
|
||||
wxMacCocoaRetain(m_nsImage);
|
||||
}
|
||||
}
|
||||
|
||||
bool wxBitmapRefData::HasNativeSize()
|
||||
|
Reference in New Issue
Block a user