Use dedicated function to round values

This commit is contained in:
Artur Wieczorek
2020-09-17 12:41:22 +02:00
parent 5274d2d647
commit 4b10b4f5e2

View File

@@ -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,