Switch to using DoGetClippingRect() instead of DoGetClippingBox()
The new method returns a boolean flag which indicates whether there is any clipping region or not and so is preferable to using the old one and checking its return value to determine this, which can't be done reliably.
This commit is contained in:
@@ -282,6 +282,17 @@ void wxGCDCImpl::UpdateClipBox()
|
||||
double x, y, w, h;
|
||||
m_graphicContext->GetClipBox(&x, &y, &w, &h);
|
||||
|
||||
// We shouldn't reset m_clipping if the clipping region that we set happens
|
||||
// to be empty (e.g. because its intersection with the previous clipping
|
||||
// region was empty), but we should set it to true if we do have a valid
|
||||
// clipping region and it was false which may happen if the clipping region
|
||||
// set from the outside of wxWidgets code.
|
||||
if ( !m_clipping )
|
||||
{
|
||||
if ( w != 0. && h != 0. )
|
||||
m_clipping = true;
|
||||
}
|
||||
|
||||
m_clipX1 = wxRound(x);
|
||||
m_clipY1 = wxRound(y);
|
||||
m_clipX2 = wxRound(x+w);
|
||||
@@ -289,9 +300,9 @@ void wxGCDCImpl::UpdateClipBox()
|
||||
m_isClipBoxValid = true;
|
||||
}
|
||||
|
||||
void wxGCDCImpl::DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
|
||||
bool wxGCDCImpl::DoGetClippingRect(wxRect& rect) const
|
||||
{
|
||||
wxCHECK_RET( IsOk(), wxS("wxGCDC::DoGetClippingRegion - invalid GC") );
|
||||
wxCHECK_MSG( IsOk(), false, wxS("wxGCDC::DoGetClippingRegion - invalid GC") );
|
||||
// Check if we should retrieve the clipping region possibly not set
|
||||
// by SetClippingRegion() but modified by application: this can
|
||||
// happen when we're associated with an existing graphics context using
|
||||
@@ -303,14 +314,7 @@ void wxGCDCImpl::DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h
|
||||
self->UpdateClipBox();
|
||||
}
|
||||
|
||||
if ( x )
|
||||
*x = m_clipX1;
|
||||
if ( y )
|
||||
*y = m_clipY1;
|
||||
if ( w )
|
||||
*w = m_clipX2 - m_clipX1;
|
||||
if ( h )
|
||||
*h = m_clipY2 - m_clipY1;
|
||||
return wxDCImpl::DoGetClippingRect(rect);
|
||||
}
|
||||
|
||||
void wxGCDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
|
||||
|
Reference in New Issue
Block a user