gdiplus: fix rounding error (?)

Rafał Mużyło galtgendo at gmail.com
Sun Oct 28 13:10:01 CDT 2012


This code doesn't make sense, yet - as noted in an old bug - it makes a
difference.
IIUC, '(REAL) (1 << 23)' was meant to mean 1e-126, but it seems gcc
thinks otherwise, as result of gdip_round(1e-126) should be zero, while
using first interpretation.
Well, the catch is that there seems to be a lot of code in gdiplus
assuming the first meaning...

-------------- next part --------------
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 726885b..b53cadb 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -5357,7 +5357,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
     if (scaled_rect.Height >= INT_MAX || scaled_rect.Height < 0.5) scaled_rect.Height = (REAL)(1 << 23);
 
     if (!(format_flags & StringFormatFlagsNoClip) &&
-        gdip_round(scaled_rect.Width) != 0 && gdip_round(scaled_rect.Height) != 0)
+        scaled_rect.Width != (REAL)(1 << 23) && scaled_rect.Height != (REAL)(1 << 23))
     {
         /* FIXME: If only the width or only the height is 0, we should probably still clip */
         rgn = CreatePolygonRgn(corners, 4, ALTERNATE);


More information about the wine-patches mailing list