X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..a39815bd30c62e13089f318028c9ee547940c4ad:/src/osx/carbon/dcclient.cpp diff --git a/src/osx/carbon/dcclient.cpp b/src/osx/carbon/dcclient.cpp index 6d3d5de47b..21f3c245bd 100644 --- a/src/osx/carbon/dcclient.cpp +++ b/src/osx/carbon/dcclient.cpp @@ -45,7 +45,7 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) : wxGCDCImpl( owner ) { m_window = window; - + m_ok = true ; m_window->GetSize( &m_width , &m_height); @@ -68,7 +68,9 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) if ( window->MacGetLeftBorderSize() != 0 || window->MacGetTopBorderSize() != 0 ) CGContextTranslateCTM( cg , -window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize() ); - SetGraphicsContext( wxGraphicsContext::CreateFromNative( cg ) ); + wxGraphicsContext* context = wxGraphicsContext::CreateFromNative( cg ); + context->EnableOffset(true); + SetGraphicsContext( context ); } DoSetClippingRegion( 0 , 0 , m_width , m_height ) ; @@ -107,7 +109,7 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const ControlRef handle = (ControlRef) m_window->GetHandle(); if ( !handle ) return wxNullBitmap; - + HIRect rect; CGImageRef image; CGContextRef context; @@ -119,11 +121,11 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const int height = subrect != NULL ? subrect->height : (int)rect.size.height ; wxBitmap bmp = wxBitmap(width, height, 32); - + context = (CGContextRef)bmp.GetHBITMAP(); - + CGContextSaveGState(context); - + CGContextTranslateCTM( context, 0, height ); CGContextScaleCTM( context, 1, -1 ); @@ -161,6 +163,8 @@ wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window ) : wxClientDCImpl::~wxClientDCImpl() { + if( GetGraphicsContext() && GetGraphicsContext()->GetNativeContext() ) + Flush(); } /*