don't use FillRect() in DoDrawRectangle() but always Rectangle(); minor code cleanup in this function

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50591 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-12-09 00:21:42 +00:00
parent f2412e6a4e
commit 1ee280b728

View File

@@ -944,34 +944,21 @@ void wxMSWDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h
wxCoord x2 = x + width; wxCoord x2 = x + width;
wxCoord y2 = y + height; wxCoord y2 = y + height;
if ((m_logicalFunction == wxCOPY) && (m_pen.GetStyle() == wxTRANSPARENT)) wxCoord x2dev = XLOG2DEV(x2),
{ y2dev = YLOG2DEV(y2);
RECT rect;
rect.left = XLOG2DEV(x);
rect.top = YLOG2DEV(y);
rect.right = XLOG2DEV(x2);
rect.bottom = YLOG2DEV(y2);
(void)FillRect(GetHdc(), &rect, (HBRUSH)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 shouldnt be done after the LOG2DEV() conversions. RR. // Windows (but not Windows CE) draws the filled rectangles without outline
if ( m_pen.GetStyle() == wxTRANSPARENT ) // (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
// Apparently not needed for WinCE (see e.g. Life! demo)
#ifndef __WXWINCE__ #ifndef __WXWINCE__
x2++; if ( m_pen.GetStyle() == wxTRANSPARENT )
y2++; {
#endif x2dev++;
} y2dev++;
(void)Rectangle(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2));
} }
#endif // !__WXWINCE__
(void)Rectangle(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), x2dev, y2dev);
CalcBoundingBox(x, y); CalcBoundingBox(x, y);
CalcBoundingBox(x2, y2); CalcBoundingBox(x2, y2);