Optimize wxDCImpl::DoSetClippingRegion

Do intersection operations directly on the final wxRect containing clip box.
This commit is contained in:
Artur Wieczorek 2016-09-01 21:24:35 +02:00
parent 588425a9d4
commit dafc865d49

View File

@ -371,15 +371,14 @@ void wxDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
wxASSERT_MSG( w >= 0 && h >= 0,
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 )
{
// New clipping box is an intersection
// of required clipping box and the current one.
wxRect curRegion(m_clipX1, m_clipY1, m_clipX2 - m_clipX1, m_clipY2 - m_clipY1);
clipRegion = curRegion.Intersect(newRegion);
clipRegion.Intersect(curRegion);
}
else
{
@ -389,7 +388,7 @@ void wxDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
DoGetSize(&dcWidth, &dcHeight);
wxRect dcRect(DeviceToLogicalX(0), DeviceToLogicalY(0),
DeviceToLogicalXRel(dcWidth), DeviceToLogicalYRel(dcHeight));
clipRegion = dcRect.Intersect(newRegion);
clipRegion.Intersect(dcRect);
m_clipping = true;
}