X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/489468feaa08b8f504735eecca522fb8d0f825d2..88c87a11a81106d950a2bbadf9426933f7b63de7:/src/osx/carbon/dcclient.cpp diff --git a/src/osx/carbon/dcclient.cpp b/src/osx/carbon/dcclient.cpp index a7f4cb2536..2ade63d5cc 100644 --- a/src/osx/carbon/dcclient.cpp +++ b/src/osx/carbon/dcclient.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/mac/carbon/dcclient.cpp +// Name: src/osx/carbon/dcclient.cpp // Purpose: wxClientDCImpl class // Author: Stefan Csomor // Modified by: @@ -25,7 +25,8 @@ #include "wx/graphics.h" #include "wx/rawbmp.h" -#include "wx/mac/private.h" +#include "wx/osx/private.h" +#include "wx/osx/dcclient.h" //----------------------------------------------------------------------------- // wxWindowDCImpl @@ -39,21 +40,20 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner ) m_release = false; } + wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) : wxGCDCImpl( owner ) { m_window = window; - WindowRef rootwindow = (WindowRef) window->MacGetTopLevelWindowRef() ; - if (!rootwindow) - return; - m_ok = true ; m_window->GetSize( &m_width , &m_height); if ( !m_window->IsShownOnScreen() ) m_width = m_height = 0; + CGContextRef cg = (CGContextRef) window->MacGetCGContextRef(); + m_release = false; if ( cg == NULL ) { @@ -96,6 +96,7 @@ void wxWindowDCImpl::DoGetSize( int* width, int* height ) const *height = m_height; } +#if wxOSX_USE_CARBON wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const { // wxScreenDC is derived from wxWindowDC, so a screen dc will @@ -103,9 +104,6 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const if (!m_window) return wxNullBitmap; -#ifdef __LP64__ - return wxNullBitmap; -#else ControlRef handle = (ControlRef) m_window->GetHandle(); if ( !handle ) return wxNullBitmap; @@ -137,10 +135,9 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const CGContextDrawImage( context, rect, image ); CGContextRestoreGState(context); - return bmp; -#endif } +#endif /* * wxClientDCImpl @@ -183,6 +180,7 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner ) wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) : wxWindowDCImpl( owner, window ) { + wxASSERT_MSG( window->MacGetCGContextRef() != NULL, _T("using wxPaintDC without being in a native paint event") ); wxPoint origin = window->GetClientAreaOrigin() ; m_window->GetClientSize( &m_width , &m_height); SetDeviceOrigin( origin.x, origin.y );