Handle negative width size in GDI+ DrawRectangle() and document it
Apparently it's a common convention to allow width and/or height of a rectangle to be negative as both GDI and Cairo handle this natively, so also allow this for GDI+ and document this as the expected behaviour. Closes #17495.
This commit is contained in:
committed by
Vadim Zeitlin
parent
cb08b32f43
commit
bb2b48f2ba
@@ -1508,6 +1508,18 @@ void wxGDIPlusContext::DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDoub
|
||||
Brush *brush = m_brush.IsNull() ? NULL : ((wxGDIPlusBrushData*)m_brush.GetRefData())->GetGDIPlusBrush();
|
||||
Pen *pen = m_pen.IsNull() ? NULL : ((wxGDIPlusPenData*)m_pen.GetGraphicsData())->GetGDIPlusPen();
|
||||
|
||||
if ( w < 0 )
|
||||
{
|
||||
x += w;
|
||||
w = -w;
|
||||
}
|
||||
|
||||
if ( h < 0 )
|
||||
{
|
||||
y += h;
|
||||
h = -h;
|
||||
}
|
||||
|
||||
if ( brush )
|
||||
{
|
||||
// the offset is used to fill only the inside of the rectangle and not paint underneath
|
||||
|
Reference in New Issue
Block a user