X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/31e39e3c51f0a14a49ba86a5326e1461ad60dfee..221ed5767f7ef4d51b0bbef50ec9f53edfaa46f2:/src/mgl/dc.cpp diff --git a/src/mgl/dc.cpp b/src/mgl/dc.cpp index 692ac021d4..e9a24c404e 100644 --- a/src/mgl/dc.cpp +++ b/src/mgl/dc.cpp @@ -47,6 +47,10 @@ // constants //----------------------------------------------------------------------------- +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + const double mm2inches = 0.0393700787402; const double inches2mm = 25.4; const double mm2twips = 56.6929133859; @@ -553,8 +557,16 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { if ( !m_penSelected ) SelectPen(); - m_MGLDC->rect(xx + m_penOfsX, yy + m_penOfsY, - xx + ww + m_penOfsX, yy + hh + m_penOfsY); + + // VS: MGLDC::rect() does not render rectangles that have width + // or height equal to 1, so we have to use MGLDC::line() + // instead... + if ( hh == 1 || ww == 1 ) + m_MGLDC->line(xx + m_penOfsX, yy + m_penOfsY, + xx + ww-1 + m_penOfsX, yy + hh-1 + m_penOfsY); + else + m_MGLDC->rect(xx + m_penOfsX, yy + m_penOfsY, + xx + ww + m_penOfsX, yy + hh + m_penOfsY); } CalcBoundingBox(x, y); @@ -1097,7 +1109,8 @@ void wxDC::SetPalette(const wxPalette& palette) if ( palette == wxNullPalette ) { - SetPalette(m_oldPalette); + if ( m_oldPalette.Ok() ) + SetPalette(m_oldPalette); return; }