From 4b10b4f5e214a47aa84c7ca7529abcbc38665a87 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 17 Sep 2020 12:41:22 +0200 Subject: [PATCH] Use dedicated function to round values --- src/common/dcgraph.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index a731de53bc..cd6c8d206e 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -1272,13 +1272,13 @@ void wxGCDCImpl::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord * ); if ( height ) - *height = (wxCoord)(h+0.5); + *height = (wxCoord)wxRound(h); if ( descent ) - *descent = (wxCoord)(d+0.5); + *descent = (wxCoord)wxRound(d); if ( externalLeading ) - *externalLeading = (wxCoord)(e+0.5); + *externalLeading = (wxCoord)wxRound(e); if ( width ) - *width = (wxCoord)(w+0.5); + *width = (wxCoord)wxRound(w); if ( theFont ) { @@ -1298,7 +1298,7 @@ bool wxGCDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& width m_graphicContext->GetPartialTextExtents( text, widthsD ); for ( size_t i = 0; i < widths.GetCount(); ++i ) - widths[i] = (wxCoord)(widthsD[i] + 0.5); + widths[i] = wxRound(widthsD[i]); return true; } @@ -1348,9 +1348,9 @@ void wxGCDCImpl::DoGetSize(int *width, int *height) const wxDouble w,h; m_graphicContext->GetSize( &w, &h ); if ( height ) - *height = (int) (h+0.5); + *height = wxRound(h); if ( width ) - *width = (int) (w+0.5); + *width = wxRound(w); } void wxGCDCImpl::DoGradientFillLinear(const wxRect& rect,