From 5ba7a1d166cd731dcdb19cf4569ec28250f846fc Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Fri, 20 Oct 2017 09:40:43 -0700 Subject: [PATCH] Draw a point instead of a line in wxGCDC::DrawPoint() See #9674, #4550 --- src/common/dcgraph.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 8e3afb3288..1278a15249 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -703,7 +703,31 @@ void wxGCDCImpl::DoDrawPoint( wxCoord x, wxCoord y ) { wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawPoint - invalid DC") ); - DoDrawLine( x , y , x + 1 , y + 1 ); + if (!m_logicalFunctionSupported) + return; + +#if defined(__WXMSW__) && wxUSE_GRAPHICS_GDIPLUS + // single point path does not work with GDI+ + if (m_graphicContext->GetRenderer() == wxGraphicsRenderer::GetGDIPlusRenderer()) + { + const double dx = 0.25 / m_scaleX; + const double dy = 0.25 / m_scaleY; + m_graphicContext->StrokeLine(x - dx, y - dy, x + dx, y + dy); + } + else +#endif + { +#ifdef __WXOSX__ + m_graphicContext->StrokeLine(x, y, x, y); +#else + wxGraphicsPath path(m_graphicContext->CreatePath()); + path.MoveToPoint(x, y); + path.CloseSubpath(); + m_graphicContext->StrokePath(path); +#endif + } + + CalcBoundingBox(x, y); } void wxGCDCImpl::DoDrawLines(int n, const wxPoint points[],