]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/dcprint.cpp
Fix for mistake with const for non pointer/reference with corrections in documentation.
[wxWidgets.git] / src / mac / carbon / dcprint.cpp
index ba563f3f48d23c96887af357f411184979100ea5..a7d3de26e9011b37e55b6a2a0af756d9bea969a3 100644 (file)
@@ -9,10 +9,6 @@
 // Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "dcprint.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -31,9 +27,7 @@
 #include "wx/mac/uma.h"
 #include "wx/mac/private/print.h"
 
-#if !USE_SHARED_LIBRARY
 IMPLEMENT_CLASS(wxPrinterDC, wxDC)
-#endif
 
 class wxNativePrinterDC
 {
@@ -182,8 +176,11 @@ void wxMacCarbonPrinterDC::StartPage( wxPrinterDC* dc )
         if ( !m_err )
         {
 #if wxMAC_USE_CORE_GRAPHICS
-            CGContextTranslateCTM( pageContext , 0 , rPage.bottom - rPage.top ) ;
+            PMRect paperRect ;
+            PMGetAdjustedPaperRect( native->m_macPageFormat , &paperRect ) ;
+            CGContextTranslateCTM( pageContext , -paperRect.left , -paperRect.top + ( rPage.bottom - rPage.top ) ) ;
             CGContextScaleCTM( pageContext , 1 , -1 ) ;
+            CGContextSaveGState( pageContext ) ;
 #else
             dc->m_macLocalOrigin.x = (int) rPage.left;
             dc->m_macLocalOrigin.y = (int) rPage.top;
@@ -233,6 +230,10 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
 
 wxPrinterDC::~wxPrinterDC(void)
 {
+#if wxMAC_USE_CORE_GRAPHICS
+    // this context was borrowed
+    ((wxMacCGContext*)(m_graphicContext))->SetNativeContext( NULL ) ;
+#endif
     delete m_nativePrinterDC ;
 }