Fix wxDC::DrawRectangle() when using RTL in wxMSW.

Extend the correct edge of the rectangle (always the physical right, not the
logical right) to fix off by one errors in RTL mode, affecting notably wxGrid.

See #16250.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77028 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-08-09 14:21:01 +00:00
parent 099ca52b29
commit 992671d2a7

View File

@ -1034,7 +1034,9 @@ void wxMSWDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h
wxCoord x2 = x + width;
wxCoord y2 = y + height;
wxCoord x2dev = XLOG2DEV(x2),
wxCoord x1dev = XLOG2DEV(x),
y1dev = YLOG2DEV(y),
x2dev = XLOG2DEV(x2),
y2dev = YLOG2DEV(y2);
// Windows (but not Windows CE) draws the filled rectangles without outline
@ -1043,12 +1045,18 @@ void wxMSWDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h
#ifndef __WXWINCE__
if ( m_pen.IsTransparent() )
{
x2dev++;
// Right edge to be extended is "displayed right edge"
// and hence its device coordinates depend
// on layout direction and can be either x1 or x2.
if ( GetLayoutDirection() == wxLayout_RightToLeft )
x1dev--;
else
x2dev++;
y2dev++;
}
#endif // !__WXWINCE__
(void)Rectangle(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), x2dev, y2dev);
(void)Rectangle(GetHdc(), x1dev, y1dev, x2dev, y2dev);
CalcBoundingBox(x, y);
CalcBoundingBox(x2, y2);