gdiplus: Rename roundr() to gdip_round() to make it clearer that it's an internal helper.

Dmitry Timoshkov dmitry at baikal.ru
Mon Aug 20 21:02:06 CDT 2012


gdi32 uses name GDI_ROUND() for the same purpose.
---
 dlls/gdiplus/brush.c           | 20 ++++++++++----------
 dlls/gdiplus/gdiplus.c         |  6 +++---
 dlls/gdiplus/gdiplus_private.h |  2 +-
 dlls/gdiplus/graphics.c        | 42 +++++++++++++++++++++---------------------
 dlls/gdiplus/graphicspath.c    | 14 +++++++-------
 dlls/gdiplus/image.c           |  8 ++++----
 dlls/gdiplus/matrix.c          |  8 ++++----
 dlls/gdiplus/region.c          | 10 +++++-----
 8 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c
index 184c8de..3319083 100644
--- a/dlls/gdiplus/brush.c
+++ b/dlls/gdiplus/brush.c
@@ -1032,8 +1032,8 @@ GpStatus WINGDIPAPI GdipGetPathGradientCenterPointI(GpPathGradient *grad,
     ret = GdipGetPathGradientCenterPoint(grad,&ptf);
 
     if(ret == Ok){
-        point->X = roundr(ptf.X);
-        point->Y = roundr(ptf.Y);
+        point->X = gdip_round(ptf.X);
+        point->Y = gdip_round(ptf.Y);
     }
 
     return ret;
@@ -1131,10 +1131,10 @@ GpStatus WINGDIPAPI GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect
     stat = GdipGetPathGradientRect(brush, &rectf);
     if(stat != Ok)  return stat;
 
-    rect->X = roundr(rectf.X);
-    rect->Y = roundr(rectf.Y);
-    rect->Width  = roundr(rectf.Width);
-    rect->Height = roundr(rectf.Height);
+    rect->X = gdip_round(rectf.X);
+    rect->Y = gdip_round(rectf.Y);
+    rect->Width  = gdip_round(rectf.Width);
+    rect->Height = gdip_round(rectf.Height);
 
     return Ok;
 }
@@ -2126,10 +2126,10 @@ GpStatus WINGDIPAPI GdipGetLineRectI(GpLineGradient *brush, GpRect *rect)
     ret = GdipGetLineRect(brush, &rectF);
 
     if(ret == Ok){
-        rect->X      = roundr(rectF.X);
-        rect->Y      = roundr(rectF.Y);
-        rect->Width  = roundr(rectF.Width);
-        rect->Height = roundr(rectF.Height);
+        rect->X      = gdip_round(rectF.X);
+        rect->Y      = gdip_round(rectF.Y);
+        rect->Width  = gdip_round(rectF.Width);
+        rect->Height = gdip_round(rectF.Height);
     }
 
     return ret;
diff --git a/dlls/gdiplus/gdiplus.c b/dlls/gdiplus/gdiplus.c
index 9ada462..1c016be 100644
--- a/dlls/gdiplus/gdiplus.c
+++ b/dlls/gdiplus/gdiplus.c
@@ -210,7 +210,7 @@ static void unstretch_angle(REAL * angle, REAL rad_x, REAL rad_y)
         return;
 
     stretched = gdiplus_atan2(sin(*angle) / fabs(rad_y), cos(*angle) / fabs(rad_x));
-    revs_off = roundr(*angle / (2.0 * M_PI)) - roundr(stretched / (2.0 * M_PI));
+    revs_off = gdip_round(*angle / (2.0 * M_PI)) - gdip_round(stretched / (2.0 * M_PI));
     stretched += ((REAL)revs_off) * M_PI * 2.0;
     *angle = stretched;
 }
@@ -394,8 +394,8 @@ void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj,
     REAL tension, REAL *x, REAL *y)
 {
     /* tangent at endpoints is the line from the endpoint to the adjacent point */
-    *x = roundr(tension * (xadj - xend) + xend);
-    *y = roundr(tension * (yadj - yend) + yend);
+    *x = gdip_round(tension * (xadj - xend) + xend);
+    *y = gdip_round(tension * (yadj - yend) + yend);
 }
 
 /* make sure path has enough space for len more points */
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index fbc6772..9c0e722 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -75,7 +75,7 @@ extern void delete_element(region_element *element) DECLSPEC_HIDDEN;
 
 extern GpStatus get_hatch_data(HatchStyle hatchstyle, const char **result) DECLSPEC_HIDDEN;
 
-static inline INT roundr(REAL x)
+static inline INT gdip_round(REAL x)
 {
     return (INT) floorf(x + 0.5);
 }
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 7068534..28fc570 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -262,20 +262,20 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
 
         TRACE("dashes are: ");
         for(i = 0; i < numdashes; i++){
-            dash_array[i] = roundr(width * pen->dashes[i]);
+            dash_array[i] = gdip_round(width * pen->dashes[i]);
             TRACE("%d, ", dash_array[i]);
         }
         TRACE("\n and the pen style is %x\n", pen->style);
 
         create_gdi_logbrush(pen->brush, &lb);
-        gdipen = ExtCreatePen(pen->style, roundr(width), &lb,
+        gdipen = ExtCreatePen(pen->style, gdip_round(width), &lb,
                               numdashes, dash_array);
         free_gdi_logbrush(&lb);
     }
     else
     {
         create_gdi_logbrush(pen->brush, &lb);
-        gdipen = ExtCreatePen(pen->style, roundr(width), &lb, 0, NULL);
+        gdipen = ExtCreatePen(pen->style, gdip_round(width), &lb, 0, NULL);
         free_gdi_logbrush(&lb);
     }
 
@@ -326,8 +326,8 @@ static void transform_and_round_points(GpGraphics *graphics, POINT *pti,
     GdipDeleteMatrix(matrix);
 
     for(i = 0; i < count; i++){
-        pti[i].x = roundr(ptf[i].X);
-        pti[i].y = roundr(ptf[i].Y);
+        pti[i].x = gdip_round(ptf[i].X);
+        pti[i].y = gdip_round(ptf[i].Y);
     }
 }
 
@@ -739,10 +739,10 @@ static void get_bitmap_sample_size(InterpolationMode interpolation, WrapMode wra
         break;
     case InterpolationModeNearestNeighbor:
     default:
-        left = roundr(srcx);
-        top = roundr(srcy);
-        right = roundr(srcx+srcwidth);
-        bottom = roundr(srcy+srcheight);
+        left = gdip_round(srcx);
+        top = gdip_round(srcy);
+        right = gdip_round(srcx+srcwidth);
+        bottom = gdip_round(srcy+srcheight);
         break;
     }
 
@@ -877,7 +877,7 @@ static ARGB resample_bitmap_pixel(GDIPCONST GpRect *src_rect, LPBYTE bits, UINT
     }
     case InterpolationModeNearestNeighbor:
         return sample_bitmap_pixel(src_rect, bits, width, height,
-            roundr(point->X), roundr(point->Y), attributes);
+            gdip_round(point->X), gdip_round(point->Y), attributes);
     }
 }
 
@@ -2150,14 +2150,14 @@ static void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font, HFONT *
                       (pt[2].X-pt[0].X)*(pt[2].X-pt[0].X));
 
     get_log_fontW(font, graphics, &lfw);
-    lfw.lfHeight = roundr(font_height * rel_height);
+    lfw.lfHeight = gdip_round(font_height * rel_height);
     unscaled_font = CreateFontIndirectW(&lfw);
 
     SelectObject(hdc, unscaled_font);
     GetTextMetricsW(hdc, &textmet);
 
-    lfw.lfWidth = roundr(textmet.tmAveCharWidth * rel_width / rel_height);
-    lfw.lfEscapement = lfw.lfOrientation = roundr((angle / M_PI) * 1800.0);
+    lfw.lfWidth = gdip_round(textmet.tmAveCharWidth * rel_width / rel_height);
+    lfw.lfEscapement = lfw.lfOrientation = gdip_round((angle / M_PI) * 1800.0);
 
     *hfont = CreateFontIndirectW(&lfw);
 
@@ -4560,10 +4560,10 @@ GpStatus WINGDIPAPI GdipGetVisibleClipBoundsI(GpGraphics *graphics, GpRect *rect
 
     if((stat = GdipGetVisibleClipBounds(graphics, &rectf)) == Ok)
     {
-        rect->X = roundr(rectf.X);
-        rect->Y = roundr(rectf.Y);
-        rect->Width  = roundr(rectf.Width);
-        rect->Height = roundr(rectf.Height);
+        rect->X = gdip_round(rectf.X);
+        rect->Y = gdip_round(rectf.Y);
+        rect->Width  = gdip_round(rectf.Width);
+        rect->Height = gdip_round(rectf.Height);
     }
 
     return stat;
@@ -5214,7 +5214,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
     scaled_rect.Width = rel_width * rect->Width;
     scaled_rect.Height = rel_height * rect->Height;
 
-    if (roundr(scaled_rect.Width) != 0 && roundr(scaled_rect.Height) != 0)
+    if (gdip_round(scaled_rect.Width) != 0 && gdip_round(scaled_rect.Height) != 0)
     {
         /* FIXME: If only the width or only the height is 0, we should probably still clip */
         rgn = CreatePolygonRgn(corners, 4, ALTERNATE);
@@ -6087,8 +6087,8 @@ GpStatus WINGDIPAPI GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace
 
     if(ret == Ok)
         for(i = 0; i < count; i++){
-            points[i].X = roundr(pointsF[i].X);
-            points[i].Y = roundr(pointsF[i].Y);
+            points[i].X = gdip_round(pointsF[i].X);
+            points[i].Y = gdip_round(pointsF[i].Y);
         }
     GdipFree(pointsF);
 
@@ -6287,7 +6287,7 @@ static GpStatus GDI32_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UINT1
 
     SetTextAlign(graphics->hdc, TA_BASELINE|TA_LEFT);
 
-    ExtTextOutW(graphics->hdc, roundr(pt.X), roundr(pt.Y), eto_flags, NULL, text, length, NULL);
+    ExtTextOutW(graphics->hdc, gdip_round(pt.X), gdip_round(pt.Y), eto_flags, NULL, text, length, NULL);
 
     RestoreDC(graphics->hdc, save_state);
 
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 98d3fe9..8533902 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -1357,8 +1357,8 @@ GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath *path, GpPoint* points, INT count)
     ret = GdipGetPathPoints(path,ptf,count);
     if(ret == Ok)
         for(i = 0;i < count;i++){
-            points[i].X = roundr(ptf[i].X);
-            points[i].Y = roundr(ptf[i].Y);
+            points[i].X = gdip_round(ptf[i].X);
+            points[i].Y = gdip_round(ptf[i].Y);
         };
     GdipFree(ptf);
 
@@ -1478,10 +1478,10 @@ GpStatus WINGDIPAPI GdipGetPathWorldBoundsI(GpPath* path, GpRect* bounds,
     ret = GdipGetPathWorldBounds(path,&boundsF,matrix,pen);
 
     if(ret == Ok){
-        bounds->X      = roundr(boundsF.X);
-        bounds->Y      = roundr(boundsF.Y);
-        bounds->Width  = roundr(boundsF.Width);
-        bounds->Height = roundr(boundsF.Height);
+        bounds->X      = gdip_round(boundsF.X);
+        bounds->Y      = gdip_round(boundsF.Y);
+        bounds->Width  = gdip_round(boundsF.Width);
+        bounds->Height = gdip_round(boundsF.Height);
     }
 
     return ret;
@@ -1607,7 +1607,7 @@ GpStatus WINGDIPAPI GdipIsVisiblePathPoint(GpPath* path, REAL x, REAL y, GpGraph
         return status;
     }
 
-    *result = PtInRegion(hrgn, roundr(x), roundr(y));
+    *result = PtInRegion(hrgn, gdip_round(x), gdip_round(y));
 
     DeleteObject(hrgn);
     GdipDeleteRegion(region);
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index d6e9faf..f40713b 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -1248,10 +1248,10 @@ GpStatus WINGDIPAPI GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height,
     if (format == PixelFormatDontCare)
         format = srcBitmap->format;
 
-    area.X = roundr(x);
-    area.Y = roundr(y);
-    area.Width = roundr(width);
-    area.Height = roundr(height);
+    area.X = gdip_round(x);
+    area.Y = gdip_round(y);
+    area.Width = gdip_round(width);
+    area.Height = gdip_round(height);
 
     stat = GdipBitmapLockBits(srcBitmap, &area, ImageLockModeRead, format,
         &lockeddata_src);
diff --git a/dlls/gdiplus/matrix.c b/dlls/gdiplus/matrix.c
index acfe989..fe03e65 100644
--- a/dlls/gdiplus/matrix.c
+++ b/dlls/gdiplus/matrix.c
@@ -393,8 +393,8 @@ GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, I
 
     if(ret == Ok)
         for(i = 0; i < count; i++){
-            pts[i].X = roundr(ptsF[i].X);
-            pts[i].Y = roundr(ptsF[i].Y);
+            pts[i].X = gdip_round(ptsF[i].X);
+            pts[i].Y = gdip_round(ptsF[i].Y);
         }
     GdipFree(ptsF);
 
@@ -474,8 +474,8 @@ GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *
     /* store back */
     if(ret == Ok)
         for(i = 0; i < count; i++){
-            pts[i].X = roundr(ptsF[i].X);
-            pts[i].Y = roundr(ptsF[i].Y);
+            pts[i].X = gdip_round(ptsF[i].X);
+            pts[i].Y = gdip_round(ptsF[i].Y);
         }
     GdipFree(ptsF);
 
diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index 2da3857..f62b599 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -715,10 +715,10 @@ GpStatus WINGDIPAPI GdipGetRegionBoundsI(GpRegion *region, GpGraphics *graphics,
 
     status = GdipGetRegionBounds(region, graphics, &rectf);
     if(status == Ok){
-        rect->X = roundr(rectf.X);
-        rect->Y = roundr(rectf.X);
-        rect->Width  = roundr(rectf.Width);
-        rect->Height = roundr(rectf.Height);
+        rect->X = gdip_round(rectf.X);
+        rect->Y = gdip_round(rectf.X);
+        rect->Width  = gdip_round(rectf.Width);
+        rect->Height = gdip_round(rectf.Height);
     }
 
     return status;
@@ -1220,7 +1220,7 @@ GpStatus WINGDIPAPI GdipIsVisibleRegionPoint(GpRegion* region, REAL x, REAL y, G
         return Ok;
     }
 
-    *res = PtInRegion(hrgn, roundr(x), roundr(y));
+    *res = PtInRegion(hrgn, gdip_round(x), gdip_round(y));
 
     DeleteObject(hrgn);
 
-- 
1.7.11.5




More information about the wine-patches mailing list