#define mm2pt 2.83464566929
#define pt2mm 0.352777777778
-long wxDC::m_macCurrentPortId = 1 ;
-
//-----------------------------------------------------------------------------
// wxDC
//-----------------------------------------------------------------------------
m_macBrushInstalled = false ;
m_macPenInstalled = false ;
- m_macPortId = 0 ;
m_macLocalOrigin.h = m_macLocalOrigin.v = 0 ;
m_macClipRect.left = -32000 ;
m_macClipRect.top = -32000 ;
m_macClipRect.right = 32000 ;
m_macClipRect.bottom = 32000 ;
- ::GetPort( &m_macOrigPort ) ;
+
+ m_pen = *wxBLACK_PEN;
+ m_font = *wxNORMAL_FONT;
+ m_brush = *wxWHITE_BRUSH;
};
+wxMacPortSetter::wxMacPortSetter( const wxDC* dc ) :
+ m_ph( dc->m_macPort )
+{
+ wxASSERT( dc->Ok() ) ;
+
+ dc->MacSetupPort(&m_ph) ;
+}
+
+wxMacPortSetter::~wxMacPortSetter()
+{
+}
+
wxDC::~wxDC(void)
{
- if ( !m_macPortHelper.IsCleared() )
- {
- GrafPtr port ;
- GetPort( &port ) ;
- SetPort( m_macPortHelper.GetCurrentPort() ) ;
- SetOrigin( 0 , 0 ) ;
- SetPort( port ) ;
- }
- /*
- if ( m_macPort )
- {
- ::SetPort( m_macPort ) ;
- ::SetOrigin( 0 , 0 ) ;
- ::ClipRect( &m_macPort->portRect ) ;
- ::PenNormal() ;
- ::SetPort( m_macOrigPort ) ;
- }
- */
- ++m_macCurrentPortId ;
};
-void wxDC::MacSetupPort() const
+void wxDC::MacSetupPort(AGAPortHelper* help) const
{
- AGAPortHelper* help = (AGAPortHelper*) &m_macPortHelper ;
help->Setup( m_macPort ) ;
- m_macPortId = ++m_macCurrentPortId ;
::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
::ClipRect(&m_macClipRect);
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx1 = XLOG2DEV(x);
long yy1 = YLOG2DEV(y);
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx1 = XLOG2DEV(x);
long yy1 = YLOG2DEV(y);
void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if( m_clipping )
{
m_clipX1 = wxMax( m_clipX1 , x ) ;
{
wxCHECK_RET( Ok(), wxT("invalid window dc") );
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (region.Empty())
{
DestroyClippingRegion();
void wxDC::DestroyClippingRegion(void)
{
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
m_clipping = FALSE;
// Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
::ClipRect(&m_macClipRect);
if (!Ok())
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
m_font = font;
m_macFontInstalled = false ;
if (!Ok() )
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
if ( m_pen == pen )
return ;
{
if (!Ok() )
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
if (m_brush == brush)
return;
{
if (!Ok())
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
if (m_backgroundBrush == brush)
return;
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (m_pen.GetStyle() != wxTRANSPARENT)
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (m_pen.GetStyle() != wxTRANSPARENT)
{
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (m_pen.GetStyle() == wxTRANSPARENT)
return;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
PolyHandle polygon = OpenPoly() ;
long x1, x2 , y1 , y2 ;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (radius < 0.0)
radius = - radius * ((width < height) ? width : height);
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask )
{
if (!Ok()) return FALSE;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
CGrafPtr sourcePort = (CGrafPtr) source->m_macPort ;
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
wxFont formerFont = m_font ;
if (!Ok())
return 1;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
MacInstallFont() ;
if (!Ok())
return 1;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
MacInstallFont() ;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
Rect rect = { -32767 , -32767 , 32767 , 32767 } ;
if (m_backgroundBrush.GetStyle() != wxTRANSPARENT)
{
if (!Ok())
return;
- MacVerifySetup() ;
- if ( m_macFontInstalled )
- return ;
+// if ( m_macFontInstalled )
+// return ;
Pattern blackColor ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
{
if (!Ok())
return;
- MacVerifySetup() ;
Pattern blackColor;
- if ( m_macPenInstalled )
- return ;
+// if ( m_macPenInstalled )
+// return ;
RGBColor forecolor = m_pen.GetColour().GetPixel();
RGBColor backcolor = m_backgroundBrush.GetColour().GetPixel();
{
if (!Ok())
return;
- MacVerifySetup() ;
+
Pattern blackColor, whiteColor ;
- if ( m_macBrushInstalled )
- return ;
+// if ( m_macBrushInstalled )
+// return ;
// foreground