Make rectangle size the same as is drawn by raster-based wxDCs

Outlined rectangles are one pixel larger with vector-based drawing,
adjust them to get consistent behavior.
Ellipses do not appear to need adjustment.
See #17091

(cherry picked from commit 4623c5ad9c)
This commit is contained in:
Paul Cornett
2015-08-09 22:06:59 -07:00
parent 20448fbcd3
commit b8abf338c8

View File

@@ -876,10 +876,9 @@ void wxGCDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
CalcBoundingBox(x, y);
CalcBoundingBox(x + w, y + h);
if ( m_graphicContext->ShouldOffset() )
if (m_pen.IsOk() && m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT && m_pen.GetWidth() > 0)
{
// if we are offsetting the entire rectangle is moved 0.5, so the
// border line gets off by 1
// outline is one pixel larger than what raster-based wxDC implementations draw
w -= 1;
h -= 1;
}
@@ -905,10 +904,9 @@ void wxGCDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
CalcBoundingBox(x, y);
CalcBoundingBox(x + w, y + h);
if ( m_graphicContext->ShouldOffset() )
if (m_pen.IsOk() && m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT && m_pen.GetWidth() > 0)
{
// if we are offsetting the entire rectangle is moved 0.5, so the
// border line gets off by 1
// outline is one pixel larger than what raster-based wxDC implementations draw
w -= 1;
h -= 1;
}
@@ -925,13 +923,6 @@ void wxGCDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
CalcBoundingBox(x, y);
CalcBoundingBox(x + w, y + h);
if ( m_graphicContext->ShouldOffset() )
{
// if we are offsetting the entire rectangle is moved 0.5, so the
// border line gets off by 1
w -= 1;
h -= 1;
}
m_graphicContext->DrawEllipse(x,y,w,h);
}