Fixed calculation of clipping box with negative size (wxGCDC).
Graphics renderers accept negative clipping box size but for internal calculations done in wxDCImpl::DoSetClippingRegion() we need to have a box defined by (x,y) at top-left corner and having non-negative size so we need to recalculate parameters if necessary.
This commit is contained in:
@@ -279,6 +279,20 @@ void wxGCDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoSetClippingRegion - invalid DC") );
|
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoSetClippingRegion - invalid DC") );
|
||||||
|
|
||||||
|
// Generally, renderers accept negative values of width/height
|
||||||
|
// but for internal calculations we need to have a box definition
|
||||||
|
// in the standard form, with (x,y) pointing to the top-left
|
||||||
|
// corner of the box and with non-negative width and height.
|
||||||
|
if ( w < 0 )
|
||||||
|
{
|
||||||
|
w = -w;
|
||||||
|
x -= (w - 1);
|
||||||
|
}
|
||||||
|
if ( h < 0 )
|
||||||
|
{
|
||||||
|
h = -h;
|
||||||
|
y -= (h - 1);
|
||||||
|
}
|
||||||
m_graphicContext->Clip( x, y, w, h );
|
m_graphicContext->Clip( x, y, w, h );
|
||||||
|
|
||||||
wxDCImpl::DoSetClippingRegion(x, y, w, h);
|
wxDCImpl::DoSetClippingRegion(x, y, w, h);
|
||||||
|
Reference in New Issue
Block a user