X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/84e7f94cb078e98b31c5ba592e10d8311b24f65b..3fcea4b10b4b47a4ae57b84552db88da8d036044:/src/mac/dc.cpp diff --git a/src/mac/dc.cpp b/src/mac/dc.cpp index 8038c0b217..9460b87304 100644 --- a/src/mac/dc.cpp +++ b/src/mac/dc.cpp @@ -46,8 +46,10 @@ IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) #define mm2pt 2.83464566929 #define pt2mm 0.352777777778 #if !defined( __DARWIN__ ) || defined(__MWERKS__) +#ifndef M_PI const double M_PI = 3.14159265358979 ; #endif +#endif const double RAD2DEG = 180.0 / M_PI; const short kEmulatedMode = -1 ; const short kUnsupportedMode = -2 ; @@ -89,12 +91,13 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) OffsetRgn( m_newClip , x , y ) ; SetClip( m_newClip ) ; DisposeRgn( insidergn ) ; -#endif +#else int x = 0 , y = 0; win->MacWindowToRootWindow( &x,&y ) ; CopyRgn( (RgnHandle) ((wxWindow*)win)->MacGetVisibleRegion().GetWXHRGN() , m_newClip ) ; OffsetRgn( m_newClip , x , y ) ; SetClip( m_newClip ) ; +#endif } } @@ -235,7 +238,11 @@ wxDC::wxDC() m_pen = *wxBLACK_PEN; m_font = *wxNORMAL_FONT; m_brush = *wxWHITE_BRUSH; +#ifdef __WXDEBUG__ + // needed to debug possible errors with two active drawing methods at the same time on + // the same DC m_macCurrentPortStateHelper = NULL ; +#endif m_macATSUIStyle = NULL ; m_macAliasWasEnabled = false; m_macForegroundPixMap = NULL ; @@ -250,8 +257,10 @@ wxDC::~wxDC(void) void wxDC::MacSetupPort(wxMacPortStateHelper* help) const { +#ifdef __WXDEBUG__ wxASSERT( m_macCurrentPortStateHelper == NULL ) ; m_macCurrentPortStateHelper = help ; +#endif SetClip( (RgnHandle) m_macCurrentClipRgn); m_macFontInstalled = false ; m_macBrushInstalled = false ; @@ -260,8 +269,10 @@ void wxDC::MacSetupPort(wxMacPortStateHelper* help) const void wxDC::MacCleanupPort(wxMacPortStateHelper* help) const { +#ifdef __WXDEBUG__ wxASSERT( m_macCurrentPortStateHelper == help ) ; m_macCurrentPortStateHelper = NULL ; +#endif if( m_macATSUIStyle ) { ::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle); @@ -463,12 +474,6 @@ void wxDC::DestroyClippingRegion() m_clipping = FALSE; } -void wxDC::DoGetSize( int* width, int* height ) const -{ - *width = m_maxX-m_minX; - *height = m_maxY-m_minY; -} - void wxDC::DoGetSizeMM( int* width, int* height ) const { int w = 0; @@ -1288,11 +1293,13 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y, double angle) { wxCHECK_RET( Ok(), wxT("wxDC::DoDrawRotatedText Invalid window dc") ); + if (angle == 0.0 ) { DrawText(str, x, y); return; } + if ( str.Length() == 0 ) return ; @@ -1384,10 +1391,12 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y, void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y) { wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC")); + wxMacPortSetter helper(this) ; long xx = XLOG2DEVMAC(x); long yy = YLOG2DEVMAC(y); #if TARGET_CARBON + bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ; if ( IsKindOf(CLASSINFO( wxPrinterDC ) ) || m_font.GetNoAntiAliasing() ) useDrawThemeText = false ; @@ -1814,7 +1823,7 @@ void wxDC::MacInstallFont() const (qdStyle & condense) ? &kTrue : &kFalse , (qdStyle & extend) ? &kTrue : &kFalse , } ; - status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag), + status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag) , atsuTags, atsuSizes, atsuValues); wxASSERT_MSG( status == noErr , wxT("couldn't set create ATSU style") ) ; }