[2/10] gdiplus: changed calls to floor to floorf

Evan Stade estade at gmail.com
Tue Jul 10 20:39:34 CDT 2007


Hi,

floor and ceil take doubles and not floats.  I ran into a rounding
error because of this.

Changelog:
*change a few floor() to floorf()
*change a few ceil() to ceilf()

 dlls/gdiplus/graphics.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

-- 
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index ae19110..c32a412 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -198,8 +198,8 @@ static void draw_cap(HDC hdc, COLORREF c
 
             /* Using roundr here can make the triangle float off the end of the
              * line. */
-            pt[0].x = ((x2 - x1) >= 0 ? floor(x2 - dx) : ceil(x2 - dx));
-            pt[0].y = ((y2 - y1) >= 0 ? floor(y2 - dy) : ceil(y2 - dy));
+            pt[0].x = ((x2 - x1) >= 0 ? floorf(x2 - dx) : ceilf(x2 - dx));
+            pt[0].y = ((y2 - y1) >= 0 ? floorf(y2 - dy) : ceilf(y2 - dy));
             pt[1].x = roundr(pt[0].x + 2.0 * dx);
             pt[1].y = roundr(pt[0].y + 2.0 * dy);
 
@@ -216,8 +216,8 @@ static void draw_cap(HDC hdc, COLORREF c
             dx = -cos(M_PI_2 + theta) * size * invert;
             dy = -sin(M_PI_2 + theta) * size * invert;
 
-            pt[0].x = ((x2 - x1) >= 0 ? floor(x2 - dx) : ceil(x2 - dx));
-            pt[0].y = ((y2 - y1) >= 0 ? floor(y2 - dy) : ceil(y2 - dy));
+            pt[0].x = ((x2 - x1) >= 0 ? floorf(x2 - dx) : ceilf(x2 - dx));
+            pt[0].y = ((y2 - y1) >= 0 ? floorf(y2 - dy) : ceilf(y2 - dy));
             pt[1].x = roundr(pt[0].x + 2.0 * dx);
             pt[1].y = roundr(pt[0].y + 2.0 * dy);
 
-- 
1.4.1


More information about the wine-patches mailing list