// 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;
wxCHECK_MSG( col, FALSE, _T("NULL colour parameter in wxDC::GetPixel"));
uchar r, g, b;
- m_MGLDC->unpackColorFast(m_MGLDC->getPixel(XLOG2DEV(x), XLOG2DEV(y)),
+ m_MGLDC->unpackColorFast(m_MGLDC->getPixel(XLOG2DEV(x), YLOG2DEV(y)),
r, g, b);
col->Set(r, g, b);
return TRUE;
m_MGLDC->makeCurrent(); // will go away with MGL6.0
if ( !m_penSelected )
SelectPen();
- m_MGLDC->lineExt(XLOG2DEV(x1) + m_penOfsX, XLOG2DEV(y1) + m_penOfsY,
- XLOG2DEV(x2) + m_penOfsX, XLOG2DEV(y2) + m_penOfsY,FALSE);
+ m_MGLDC->lineExt(XLOG2DEV(x1) + m_penOfsX, YLOG2DEV(y1) + m_penOfsY,
+ XLOG2DEV(x2) + m_penOfsX, YLOG2DEV(y2) + m_penOfsY,FALSE);
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
}
{
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);
if ( palette == wxNullPalette )
{
- SetPalette(m_oldPalette);
+ if ( m_oldPalette.Ok() )
+ SetPalette(m_oldPalette);
return;
}
void wxDC::SetFont(const wxFont& font)
{
- wxCHECK_RET( font.Ok(), wxT("invalid font") );
- m_font = font;
- m_mglFont = NULL;
+ if ( font.Ok() )
+ {
+ m_font = font;
+ m_mglFont = NULL;
+ }
}
void wxDC::SetBackground(const wxBrush& brush)