From e5510b8526112cf49633c0368f59c26bbf172f8d Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 11 Oct 2013 11:13:18 +0000 Subject: [PATCH] Corrected conversion of small dimensions to pixels git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74983 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/richtext/richtextbuffer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index eff6781d72..71df40d1a5 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -629,11 +629,13 @@ int wxRichTextObject::ConvertTenthsMMToPixels(int ppi, int units, double scale) if (scale != 1.0) pixels /= scale; - // If the result is very small, make it at least one pixel in size. - if (pixels == 0 && units > 0) - pixels = 1; + int pixelsInt = int(pixels + 0.5); - return (int) pixels; + // If the result is very small, make it at least one pixel in size. + if (pixelsInt == 0 && units > 0) + pixelsInt = 1; + + return pixelsInt; } // Convert units in pixels to tenths of a millimetre