diff --git a/src/generic/renderg.cpp b/src/generic/renderg.cpp index a754440ea8..04f7b719c3 100644 --- a/src/generic/renderg.cpp +++ b/src/generic/renderg.cpp @@ -34,8 +34,9 @@ #include "wx/control.h" #endif //WX_PRECOMP -#include "wx/splitter.h" #include "wx/dcmirror.h" +#include "wx/math.h" +#include "wx/splitter.h" #ifdef __WXMAC__ #include "wx/osx/private.h" @@ -802,7 +803,7 @@ void wxRendererGeneric::DrawGauge(wxWindow* win, wxDC& dc, const wxRect& rect, i // Calculate the progress bar size. wxRect progRect(rect); progRect.Deflate(2); - progRect.SetWidth(progRect.GetWidth() * ((double)value / max)); + progRect.width = wxMulDivInt32(progRect.width, value, max); dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); dc.SetPen(*wxTRANSPARENT_PEN); diff --git a/src/msw/renderer.cpp b/src/msw/renderer.cpp index 18a2eef532..e0b46a35d5 100644 --- a/src/msw/renderer.cpp +++ b/src/msw/renderer.cpp @@ -31,6 +31,7 @@ #endif //WX_PRECOMP #include "wx/dcgraph.h" +#include "wx/math.h" #include "wx/scopeguard.h" #include "wx/splitter.h" #include "wx/renderer.h" @@ -627,7 +628,7 @@ void wxRendererMSW::DrawGauge(wxWindow* win, // Calc progress bar size wxRect progRect(rect); progRect.Deflate(2); - progRect.SetWidth(progRect.GetWidth() * ((double)value / max)); + progRect.width = wxMulDivInt32(progRect.width, value, max); dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); dc.SetPen(*wxTRANSPARENT_PEN); @@ -960,7 +961,10 @@ void wxRendererXP::DrawGauge(wxWindow* win, &r, &contentRect); - contentRect.right = contentRect.left + (contentRect.right - contentRect.left) * ((double)value / max); + contentRect.right = contentRect.left + + wxMulDivInt32(contentRect.right - contentRect.left, + value, + max); wxUxThemeEngine::Get()->DrawThemeBackground( hTheme,