/////////////////////////////////////////////////////////////////////////////
-// Name: src/mac/carbon/dcclient.cpp
+// Name: src/osx/carbon/dcclient.cpp
// Purpose: wxClientDCImpl class
// Author: Stefan Csomor
// Modified by:
: wxGCDCImpl( owner )
{
m_window = window;
-
+
m_ok = true ;
m_window->GetSize( &m_width , &m_height);
ControlRef handle = (ControlRef) m_window->GetHandle();
if ( !handle )
return wxNullBitmap;
-
+
HIRect rect;
CGImageRef image;
CGContextRef context;
- void* data;
-
- size_t bytesPerRow;
HIViewCreateOffscreenImage( handle, 0, &rect, &image);
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 );
CGContextDrawImage( context, rect, image );
CGContextRestoreGState(context);
-
return bmp;
}
#endif
wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window ) :
wxWindowDCImpl( owner, window )
{
- wxCHECK_RET( window, _T("invalid window in wxClientDCImpl") );
+ wxCHECK_RET( window, wxT("invalid window in wxClientDCImpl") );
wxPoint origin = window->GetClientAreaOrigin() ;
m_window->GetClientSize( &m_width , &m_height);
if ( !m_window->IsShownOnScreen() )
wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) :
wxWindowDCImpl( owner, window )
{
+ wxASSERT_MSG( window->MacGetCGContextRef() != NULL, wxT("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 );