Fixed setting clipping box with negative size (wxDC, GTK).

Rectangular clipping region with negative size is accepted by wxDC::SetClippingRegion() (for compatibility with wxGCDC and Cairo) but for internal calculations we need to have this box defined by (x,y) at top-left corner and having non-negative size so we need to recalculate box's parameters in wxWindowDCImpl::DoSetClippingRegion() if necessary.
This commit is contained in:
Artur Wieczorek
2016-07-16 23:41:29 +02:00
parent 79ffd029fa
commit ad9ebd4b54

View File

@@ -1871,6 +1871,20 @@ void wxWindowDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, w
if (!m_gdkwindow) return;
// For internal calculations we need to have box definition
// in the canonical form, with (x,y) pointing to the top-left
// corner of the box and with non-negative width and height.
if ( width < 0 )
{
width = -width;
x -= (width - 1);
}
if ( height < 0 )
{
height = -height;
y -= (height - 1);
}
wxRect rect;
rect.x = XLOG2DEV(x);
rect.y = YLOG2DEV(y);