X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b02d43401061e4c691811df24e849d57765dab7b..d75a69e8329cecf6f07c667ffc015186c230a2b5:/src/common/dcgraph.cpp diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 2dc10c9a3d..48b92bda0d 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -30,8 +30,8 @@ #include "wx/dcclient.h" -#ifdef __WXMAC__ -#include "wx/mac/private.h" +#ifdef __WXOSX__ + #include "ApplicationServices/ApplicationServices.h" #endif //----------------------------------------------------------------------------- @@ -65,6 +65,11 @@ wxGCDC::wxGCDC( const wxMemoryDC& dc) : { } +wxGCDC::wxGCDC( const wxPrinterDC& dc) : + wxDC( new wxGCDCImpl( this, dc ) ) +{ +} + wxGCDC::wxGCDC() : wxDC( new wxGCDCImpl( this ) ) { @@ -127,6 +132,13 @@ wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ) : SetGraphicsContext( wxGraphicsContext::Create(dc) ); } +wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc ) : + wxDCImpl( owner ) +{ + Init(); + SetGraphicsContext( wxGraphicsContext::Create(dc) ); +} + void wxGCDCImpl::Init() { m_ok = false; @@ -197,7 +209,7 @@ void wxGCDCImpl::EndPage() void wxGCDCImpl::Flush() { -#ifdef __WXMAC__ +#ifdef __WXOSX__ CGContextFlush( (CGContextRef) m_graphicContext->GetNativeContext() ); #endif } @@ -952,8 +964,13 @@ void wxGCDCImpl::Clear(void) void wxGCDCImpl::DoGetSize(int *width, int *height) const { - *width = 10000; - *height = 10000; + wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoGetSize - invalid DC") ); + wxDouble w,h; + m_graphicContext->GetSize( &w, &h ); + if ( height ) + *height = (int) (h+0.5); + if ( width ) + *width = (int) (w+0.5); } void wxGCDCImpl::DoGradientFillLinear(const wxRect& rect,