Fallback to old API if there was an error getting the printer resolution

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2008-06-02 18:22:15 +00:00
parent 24755a87af
commit a31d0ae84c

View File

@@ -92,10 +92,12 @@ wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data )
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
PMPrinter printer;
PMSessionGetCurrentPrinter(native->m_macPrintSession, &printer);
PMPrinterGetOutputResolution( printer, native->m_macPrintSettings, &res) ;
#else
m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res);
m_err = PMPrinterGetOutputResolution( printer, native->m_macPrintSettings, &res) ;
if ( m_err )
// fallback to the old API if there was an error
#endif
m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res);
m_ppi = wxSize(int(res.hRes), int(res.vRes));
}
@@ -153,10 +155,12 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& WXUNUSED
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
PMPrinter printer;
PMSessionGetCurrentPrinter(native->m_macPrintSession, &printer);
PMPrinterGetOutputResolution( printer, native->m_macPrintSettings, &res) ;
#else
m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res);
m_err = PMPrinterGetOutputResolution( printer, native->m_macPrintSettings, &res) ;
if ( m_err )
// fallback to the old API if there was an error
#endif
m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res);
m_ppi = wxSize(int(res.hRes), int(res.vRes));
return true ;
}