use ResetClipping() instead of simply setting m_clipping to false; added call to it to wxDCBase::DestroyClippingRegion() so that some ports don't have to define their own version of it at all

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27107 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-05-05 22:43:57 +00:00
parent 2e76da5450
commit d16b634fa3
12 changed files with 186 additions and 213 deletions

View File

@@ -133,6 +133,7 @@ public:
#endif // wxUSE_PALETTE #endif // wxUSE_PALETTE
{ {
ResetBoundingBox(); ResetBoundingBox();
ResetClipping();
} }
~wxDCBase() { } ~wxDCBase() { }
@@ -390,21 +391,13 @@ public:
void SetClippingRegion(const wxRegion& region) void SetClippingRegion(const wxRegion& region)
{ DoSetClippingRegionAsRegion(region); } { DoSetClippingRegionAsRegion(region); }
virtual void DestroyClippingRegion() = 0; virtual void DestroyClippingRegion() { ResetClipping(); }
void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
{ DoGetClippingBox(x, y, w, h); } { DoGetClippingBox(x, y, w, h); }
void GetClippingBox(wxRect& rect) const void GetClippingBox(wxRect& rect) const
{ {
#if 1
DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height);
#else
// Necessary to use intermediate variables for 16-bit compilation
// REMOVE ME if the above is OK for all current platforms
wxCoord x, y, w, h;
DoGetClippingBox(&x, &y, &w, &h);
rect.x = x; rect.y = y; rect.width = w; rect.height = h;
#endif
} }
// text extent // text extent
@@ -699,17 +692,14 @@ protected:
virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, virtual void DoGetClippingBox(wxCoord *x, wxCoord *y,
wxCoord *w, wxCoord *h) const wxCoord *w, wxCoord *h) const
{ {
if ( m_clipping ) if ( x )
{ *x = m_clipX1;
if ( x ) *x = m_clipX1; if ( y )
if ( y ) *y = m_clipY1; *y = m_clipY1;
if ( w ) *w = m_clipX2 - m_clipX1; if ( w )
if ( h ) *h = m_clipY2 - m_clipY1; *w = m_clipX2 - m_clipX1;
} if ( h )
else *h = m_clipY2 - m_clipY1;
{
*x = *y = *w = *h = 0;
}
} }
virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const
@@ -737,6 +727,14 @@ protected:
#endif #endif
protected: protected:
// unset clipping variables (after clipping region was destroyed)
void ResetClipping()
{
m_clipping = false;
m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0;
}
// flags // flags
bool m_colour:1; bool m_colour:1;
bool m_ok:1; bool m_ok:1;

View File

@@ -46,9 +46,6 @@ public:
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); }; void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
// the first two must be overridden and called
virtual void DestroyClippingRegion();
// Resolution in pixels per logical inch // Resolution in pixels per logical inch
virtual wxSize GetPPI() const; virtual wxSize GetPPI() const;

View File

@@ -46,9 +46,6 @@ public:
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); }; void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
// the first two must be overridden and called
virtual void DestroyClippingRegion();
// Resolution in pixels per logical inch // Resolution in pixels per logical inch
virtual wxSize GetPPI() const; virtual wxSize GetPPI() const;

View File

@@ -52,8 +52,6 @@ public:
// implement base class pure virtuals // implement base class pure virtuals
// ---------------------------------- // ----------------------------------
virtual void DestroyClippingRegion();
virtual wxSize GetPPI() const; virtual wxSize GetPPI() const;
virtual void SetMapMode(int mode); virtual void SetMapMode(int mode);

View File

@@ -50,8 +50,6 @@ public:
// implement base class pure virtuals // implement base class pure virtuals
// ---------------------------------- // ----------------------------------
virtual void DestroyClippingRegion();
virtual wxSize GetPPI() const; virtual wxSize GetPPI() const;
virtual void SetMapMode(int mode); virtual void SetMapMode(int mode);

View File

@@ -65,11 +65,6 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
m_clipY2 = y + height; m_clipY2 = y + height;
} }
void wxDC::DestroyClippingRegion()
{
m_clipping = FALSE;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// get DC capabilities // get DC capabilities
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -65,11 +65,6 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
m_clipY2 = y + height; m_clipY2 = y + height;
} }
void wxDC::DestroyClippingRegion()
{
m_clipping = FALSE;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// get DC capabilities // get DC capabilities
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -512,7 +512,7 @@ void wxDC::DestroyClippingRegion()
{ {
wxMacFastPortSetter helper(this) ; wxMacFastPortSetter helper(this) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ; CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
m_clipping = FALSE; ResetClipping();
} }
void wxDC::DoGetSizeMM( int* width, int* height ) const void wxDC::DoGetSizeMM( int* width, int* height ) const

View File

@@ -533,7 +533,7 @@ void wxDC::DestroyClippingRegion()
{ {
wxMacFastPortSetter helper(this) ; wxMacFastPortSetter helper(this) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ; CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
m_clipping = FALSE; ResetClipping();
} }
void wxDC::DoGetSizeMM( int* width, int* height ) const void wxDC::DoGetSizeMM( int* width, int* height ) const

View File

@@ -288,7 +288,7 @@ void wxDC::DestroyClippingRegion()
else else
{ {
m_MGLDC->setClipRect(MGLRect(0, 0, m_MGLDC->sizex()+1, m_MGLDC->sizey()+1)); m_MGLDC->setClipRect(MGLRect(0, 0, m_MGLDC->sizex()+1, m_MGLDC->sizey()+1));
m_clipping = FALSE; ResetClipping();
m_currentClippingRegion.Clear(); m_currentClippingRegion.Clear();
} }
} }

View File

@@ -90,11 +90,6 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
m_clipY2 = y + height; m_clipY2 = y + height;
} }
void wxDC::DestroyClippingRegion()
{
m_clipping = FALSE;
}
void wxDC::DoGetSize( int* width, int* height ) const void wxDC::DoGetSize( int* width, int* height ) const
{ {
if ( width ) if ( width )

View File

@@ -503,7 +503,7 @@ void wxDC::DestroyClippingRegion(void)
::GpiSetClipRegion(m_hPS, hRgn, &hRgnOld); ::GpiSetClipRegion(m_hPS, hRgn, &hRgnOld);
} }
m_clipping = false; ResetClipping();
} // end of wxDC::DestroyClippingRegion } // end of wxDC::DestroyClippingRegion
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------