Optimize wxDCImpl::DoSetClippingRegion
Do intersection operations directly on the final wxRect containing clip box.
This commit is contained in:
@@ -371,15 +371,14 @@ void wxDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
|
|||||||
wxASSERT_MSG( w >= 0 && h >= 0,
|
wxASSERT_MSG( w >= 0 && h >= 0,
|
||||||
wxS("Clipping box size values cannot be negative") );
|
wxS("Clipping box size values cannot be negative") );
|
||||||
|
|
||||||
wxRect newRegion(x, y, w, h);
|
wxRect clipRegion(x, y, w, h);
|
||||||
|
|
||||||
wxRect clipRegion;
|
|
||||||
if ( m_clipping )
|
if ( m_clipping )
|
||||||
{
|
{
|
||||||
// New clipping box is an intersection
|
// New clipping box is an intersection
|
||||||
// of required clipping box and the current one.
|
// of required clipping box and the current one.
|
||||||
wxRect curRegion(m_clipX1, m_clipY1, m_clipX2 - m_clipX1, m_clipY2 - m_clipY1);
|
wxRect curRegion(m_clipX1, m_clipY1, m_clipX2 - m_clipX1, m_clipY2 - m_clipY1);
|
||||||
clipRegion = curRegion.Intersect(newRegion);
|
clipRegion.Intersect(curRegion);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -389,7 +388,7 @@ void wxDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
|
|||||||
DoGetSize(&dcWidth, &dcHeight);
|
DoGetSize(&dcWidth, &dcHeight);
|
||||||
wxRect dcRect(DeviceToLogicalX(0), DeviceToLogicalY(0),
|
wxRect dcRect(DeviceToLogicalX(0), DeviceToLogicalY(0),
|
||||||
DeviceToLogicalXRel(dcWidth), DeviceToLogicalYRel(dcHeight));
|
DeviceToLogicalXRel(dcWidth), DeviceToLogicalYRel(dcHeight));
|
||||||
clipRegion = dcRect.Intersect(newRegion);
|
clipRegion.Intersect(dcRect);
|
||||||
|
|
||||||
m_clipping = true;
|
m_clipping = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user