From: Robert Roebling Date: Mon, 21 Feb 2000 14:12:20 +0000 (+0000) Subject: Make use of FillRect() when possible. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5456b91616275ef538a6d13eff3ea00ac6c95447 Make use of FillRect() when possible. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 5729050ac6..b9fdcbe24e 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -576,16 +576,31 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxCoord x2 = x + width; wxCoord y2 = y + height; - // Windows draws the filled rectangles without outline (i.e. drawn with a - // transparent pen) one pixel smaller in both directions and we want them - // to have the same size regardless of which pen is used - adjust - if ( m_pen.GetStyle() == wxTRANSPARENT ) + if ((m_logicalFunction == wxCOPY) && (m_pen.GetStyle() == wxTRANSPARENT)) { - x2++; - y2++; + RECT rect; + rect.left = XLOG2DEV(x); + rect.top = YLOG2DEV(y); + rect.right = XLOG2DEV(x2); + rect.bottom = YLOG2DEV(y2); + (void)FillRect(GetHdc(), &rect, m_brush.GetResourceHandle() ); + } + else + { + // Windows draws the filled rectangles without outline (i.e. drawn with a + // transparent pen) one pixel smaller in both directions and we want them + // to have the same size regardless of which pen is used - adjust + + // I wonder if this shouldn´t be done after the LOG2DEV() conversions. RR. + if ( m_pen.GetStyle() == wxTRANSPARENT ) + { + x2++; + y2++; + } + + (void)Rectangle(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2)); } - (void)Rectangle(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2)); CalcBoundingBox(x, y); CalcBoundingBox(x2, y2);