From 87e9b3963e8292cff637a9f1bb8e7e2d5a5ee3f6 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 3 Sep 2018 09:34:03 +0200 Subject: [PATCH] Fixing creation from CGContextRef Our native buffer must be updated as well, otherwise RawAccess will fail --- src/osx/core/bitmap.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 52d161b17b..2bad5c9462 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -340,6 +340,12 @@ bool wxBitmapRefData::Create(CGContextRef context) // our own contexts conform to this, always. wxASSERT( m_depth == 32 ); + size_t size = m_bytesPerRow * m_height ; + void* data = m_memBuf.GetWriteBuf( size ) ; + + memcpy( data , CGBitmapContextGetData(context) , size ) ; + m_memBuf.UngetWriteBuf( size ) ; + // determine content scale CGRect userrect = CGRectMake(0, 0, 10, 10); CGRect devicerect;