adding QDSwapPort for performance reasons

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2004-04-02 08:37:46 +00:00
parent 943b730f1f
commit bb253bfd67
3 changed files with 11 additions and 10 deletions

View File

@ -79,8 +79,7 @@ public :
wxMacFastPortSetter( const wxDC *dc ) wxMacFastPortSetter( const wxDC *dc )
{ {
wxASSERT( dc->Ok() ) ; wxASSERT( dc->Ok() ) ;
GetPort( &m_oldPort ) ; m_swapped = QDSwapPort( (GrafPtr) dc->m_macPort , &m_oldPort ) ;
SetPort( (GrafPtr) dc->m_macPort ) ;
m_clipRgn = NewRgn() ; m_clipRgn = NewRgn() ;
GetClip( m_clipRgn ) ; GetClip( m_clipRgn ) ;
m_dc = dc ; m_dc = dc ;
@ -88,13 +87,15 @@ public :
} }
~wxMacFastPortSetter() ~wxMacFastPortSetter()
{ {
SetPort( (GrafPtr) m_dc->m_macPort ) ; // SetPort( (GrafPtr) m_dc->m_macPort ) ;
SetClip( m_clipRgn ) ; SetClip( m_clipRgn ) ;
if ( m_swapped )
SetPort( m_oldPort ) ; SetPort( m_oldPort ) ;
m_dc->MacCleanupPort( NULL ) ; m_dc->MacCleanupPort( NULL ) ;
DisposeRgn( m_clipRgn ) ; DisposeRgn( m_clipRgn ) ;
} }
private : private :
bool m_swapped ;
RgnHandle m_clipRgn ; RgnHandle m_clipRgn ;
GrafPtr m_oldPort ; GrafPtr m_oldPort ;
const wxDC* m_dc ; const wxDC* m_dc ;

View File

@ -228,10 +228,10 @@ void wxMacToolTip::Draw()
tag.version = kMacHelpVersion; tag.version = kMacHelpVersion;
SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ; SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ;
GrafPtr port ; GrafPtr port ;
GetPort( &port ) ; bool swapped = QDSwapPort( GetWindowPort( m_window ) , &port ) ;
SetPortWindowPort(m_window) ;
LocalToGlobal( (Point *) &tag.absHotRect.top ); LocalToGlobal( (Point *) &tag.absHotRect.top );
LocalToGlobal( (Point *) &tag.absHotRect.bottom ); LocalToGlobal( (Point *) &tag.absHotRect.bottom );
if ( swapped )
SetPort( port ); SetPort( port );
m_helpTextRef.Assign( m_label , wxFONTENCODING_DEFAULT ) ; m_helpTextRef.Assign( m_label , wxFONTENCODING_DEFAULT ) ;
tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ; tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;

View File

@ -909,9 +909,9 @@ void wxWindowMac::MacGetPositionAndSizeFromControl(int& x, int& y,
{ {
Point tlworigin = { 0 , 0 } ; Point tlworigin = { 0 , 0 } ;
GrafPtr port ; GrafPtr port ;
::GetPort( &port ) ; bool swapped = QDSwapPort( UMAGetWindowPort( (WindowRef) tlw->MacGetWindowRef() ) , &port ) ;
::SetPort( UMAGetWindowPort( (WindowRef) tlw->MacGetWindowRef() ) ) ;
::LocalToGlobal( &tlworigin ) ; ::LocalToGlobal( &tlworigin ) ;
if ( swapped )
::SetPort( port ) ; ::SetPort( port ) ;
x = tlworigin.h ; x = tlworigin.h ;
y = tlworigin.v ; y = tlworigin.v ;