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

This commit is contained in:
Dmitry Timoshkov 2012-08-21 11:02:06 +09:00 committed by Alexandre Julliard
parent d96cd05efe
commit 10c84dfe3b
8 changed files with 55 additions and 55 deletions

View File

@ -1032,8 +1032,8 @@ GpStatus WINGDIPAPI GdipGetPathGradientCenterPointI(GpPathGradient *grad,
ret = GdipGetPathGradientCenterPoint(grad,&ptf); ret = GdipGetPathGradientCenterPoint(grad,&ptf);
if(ret == Ok){ if(ret == Ok){
point->X = roundr(ptf.X); point->X = gdip_round(ptf.X);
point->Y = roundr(ptf.Y); point->Y = gdip_round(ptf.Y);
} }
return ret; return ret;
@ -1131,10 +1131,10 @@ GpStatus WINGDIPAPI GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect
stat = GdipGetPathGradientRect(brush, &rectf); stat = GdipGetPathGradientRect(brush, &rectf);
if(stat != Ok) return stat; if(stat != Ok) return stat;
rect->X = roundr(rectf.X); rect->X = gdip_round(rectf.X);
rect->Y = roundr(rectf.Y); rect->Y = gdip_round(rectf.Y);
rect->Width = roundr(rectf.Width); rect->Width = gdip_round(rectf.Width);
rect->Height = roundr(rectf.Height); rect->Height = gdip_round(rectf.Height);
return Ok; return Ok;
} }
@ -2126,10 +2126,10 @@ GpStatus WINGDIPAPI GdipGetLineRectI(GpLineGradient *brush, GpRect *rect)
ret = GdipGetLineRect(brush, &rectF); ret = GdipGetLineRect(brush, &rectF);
if(ret == Ok){ if(ret == Ok){
rect->X = roundr(rectF.X); rect->X = gdip_round(rectF.X);
rect->Y = roundr(rectF.Y); rect->Y = gdip_round(rectF.Y);
rect->Width = roundr(rectF.Width); rect->Width = gdip_round(rectF.Width);
rect->Height = roundr(rectF.Height); rect->Height = gdip_round(rectF.Height);
} }
return ret; return ret;

View File

@ -210,7 +210,7 @@ static void unstretch_angle(REAL * angle, REAL rad_x, REAL rad_y)
return; return;
stretched = gdiplus_atan2(sin(*angle) / fabs(rad_y), cos(*angle) / fabs(rad_x)); 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; stretched += ((REAL)revs_off) * M_PI * 2.0;
*angle = stretched; *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) REAL tension, REAL *x, REAL *y)
{ {
/* tangent at endpoints is the line from the endpoint to the adjacent point */ /* tangent at endpoints is the line from the endpoint to the adjacent point */
*x = roundr(tension * (xadj - xend) + xend); *x = gdip_round(tension * (xadj - xend) + xend);
*y = roundr(tension * (yadj - yend) + yend); *y = gdip_round(tension * (yadj - yend) + yend);
} }
/* make sure path has enough space for len more points */ /* make sure path has enough space for len more points */

View File

@ -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; 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); return (INT) floorf(x + 0.5);
} }

View File

@ -262,20 +262,20 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
TRACE("dashes are: "); TRACE("dashes are: ");
for(i = 0; i < numdashes; i++){ 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("%d, ", dash_array[i]);
} }
TRACE("\n and the pen style is %x\n", pen->style); TRACE("\n and the pen style is %x\n", pen->style);
create_gdi_logbrush(pen->brush, &lb); create_gdi_logbrush(pen->brush, &lb);
gdipen = ExtCreatePen(pen->style, roundr(width), &lb, gdipen = ExtCreatePen(pen->style, gdip_round(width), &lb,
numdashes, dash_array); numdashes, dash_array);
free_gdi_logbrush(&lb); free_gdi_logbrush(&lb);
} }
else else
{ {
create_gdi_logbrush(pen->brush, &lb); 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); free_gdi_logbrush(&lb);
} }
@ -326,8 +326,8 @@ static void transform_and_round_points(GpGraphics *graphics, POINT *pti,
GdipDeleteMatrix(matrix); GdipDeleteMatrix(matrix);
for(i = 0; i < count; i++){ for(i = 0; i < count; i++){
pti[i].x = roundr(ptf[i].X); pti[i].x = gdip_round(ptf[i].X);
pti[i].y = roundr(ptf[i].Y); pti[i].y = gdip_round(ptf[i].Y);
} }
} }
@ -739,10 +739,10 @@ static void get_bitmap_sample_size(InterpolationMode interpolation, WrapMode wra
break; break;
case InterpolationModeNearestNeighbor: case InterpolationModeNearestNeighbor:
default: default:
left = roundr(srcx); left = gdip_round(srcx);
top = roundr(srcy); top = gdip_round(srcy);
right = roundr(srcx+srcwidth); right = gdip_round(srcx+srcwidth);
bottom = roundr(srcy+srcheight); bottom = gdip_round(srcy+srcheight);
break; break;
} }
@ -877,7 +877,7 @@ static ARGB resample_bitmap_pixel(GDIPCONST GpRect *src_rect, LPBYTE bits, UINT
} }
case InterpolationModeNearestNeighbor: case InterpolationModeNearestNeighbor:
return sample_bitmap_pixel(src_rect, bits, width, height, 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)); (pt[2].X-pt[0].X)*(pt[2].X-pt[0].X));
get_log_fontW(font, graphics, &lfw); 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); unscaled_font = CreateFontIndirectW(&lfw);
SelectObject(hdc, unscaled_font); SelectObject(hdc, unscaled_font);
GetTextMetricsW(hdc, &textmet); GetTextMetricsW(hdc, &textmet);
lfw.lfWidth = roundr(textmet.tmAveCharWidth * rel_width / rel_height); lfw.lfWidth = gdip_round(textmet.tmAveCharWidth * rel_width / rel_height);
lfw.lfEscapement = lfw.lfOrientation = roundr((angle / M_PI) * 1800.0); lfw.lfEscapement = lfw.lfOrientation = gdip_round((angle / M_PI) * 1800.0);
*hfont = CreateFontIndirectW(&lfw); *hfont = CreateFontIndirectW(&lfw);
@ -4560,10 +4560,10 @@ GpStatus WINGDIPAPI GdipGetVisibleClipBoundsI(GpGraphics *graphics, GpRect *rect
if((stat = GdipGetVisibleClipBounds(graphics, &rectf)) == Ok) if((stat = GdipGetVisibleClipBounds(graphics, &rectf)) == Ok)
{ {
rect->X = roundr(rectf.X); rect->X = gdip_round(rectf.X);
rect->Y = roundr(rectf.Y); rect->Y = gdip_round(rectf.Y);
rect->Width = roundr(rectf.Width); rect->Width = gdip_round(rectf.Width);
rect->Height = roundr(rectf.Height); rect->Height = gdip_round(rectf.Height);
} }
return stat; return stat;
@ -5214,7 +5214,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
scaled_rect.Width = rel_width * rect->Width; scaled_rect.Width = rel_width * rect->Width;
scaled_rect.Height = rel_height * rect->Height; 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 */ /* FIXME: If only the width or only the height is 0, we should probably still clip */
rgn = CreatePolygonRgn(corners, 4, ALTERNATE); rgn = CreatePolygonRgn(corners, 4, ALTERNATE);
@ -6087,8 +6087,8 @@ GpStatus WINGDIPAPI GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace
if(ret == Ok) if(ret == Ok)
for(i = 0; i < count; i++){ for(i = 0; i < count; i++){
points[i].X = roundr(pointsF[i].X); points[i].X = gdip_round(pointsF[i].X);
points[i].Y = roundr(pointsF[i].Y); points[i].Y = gdip_round(pointsF[i].Y);
} }
GdipFree(pointsF); GdipFree(pointsF);
@ -6287,7 +6287,7 @@ static GpStatus GDI32_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UINT1
SetTextAlign(graphics->hdc, TA_BASELINE|TA_LEFT); 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); RestoreDC(graphics->hdc, save_state);

View File

@ -1357,8 +1357,8 @@ GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath *path, GpPoint* points, INT count)
ret = GdipGetPathPoints(path,ptf,count); ret = GdipGetPathPoints(path,ptf,count);
if(ret == Ok) if(ret == Ok)
for(i = 0;i < count;i++){ for(i = 0;i < count;i++){
points[i].X = roundr(ptf[i].X); points[i].X = gdip_round(ptf[i].X);
points[i].Y = roundr(ptf[i].Y); points[i].Y = gdip_round(ptf[i].Y);
}; };
GdipFree(ptf); GdipFree(ptf);
@ -1478,10 +1478,10 @@ GpStatus WINGDIPAPI GdipGetPathWorldBoundsI(GpPath* path, GpRect* bounds,
ret = GdipGetPathWorldBounds(path,&boundsF,matrix,pen); ret = GdipGetPathWorldBounds(path,&boundsF,matrix,pen);
if(ret == Ok){ if(ret == Ok){
bounds->X = roundr(boundsF.X); bounds->X = gdip_round(boundsF.X);
bounds->Y = roundr(boundsF.Y); bounds->Y = gdip_round(boundsF.Y);
bounds->Width = roundr(boundsF.Width); bounds->Width = gdip_round(boundsF.Width);
bounds->Height = roundr(boundsF.Height); bounds->Height = gdip_round(boundsF.Height);
} }
return ret; return ret;
@ -1607,7 +1607,7 @@ GpStatus WINGDIPAPI GdipIsVisiblePathPoint(GpPath* path, REAL x, REAL y, GpGraph
return status; return status;
} }
*result = PtInRegion(hrgn, roundr(x), roundr(y)); *result = PtInRegion(hrgn, gdip_round(x), gdip_round(y));
DeleteObject(hrgn); DeleteObject(hrgn);
GdipDeleteRegion(region); GdipDeleteRegion(region);

View File

@ -1248,10 +1248,10 @@ GpStatus WINGDIPAPI GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height,
if (format == PixelFormatDontCare) if (format == PixelFormatDontCare)
format = srcBitmap->format; format = srcBitmap->format;
area.X = roundr(x); area.X = gdip_round(x);
area.Y = roundr(y); area.Y = gdip_round(y);
area.Width = roundr(width); area.Width = gdip_round(width);
area.Height = roundr(height); area.Height = gdip_round(height);
stat = GdipBitmapLockBits(srcBitmap, &area, ImageLockModeRead, format, stat = GdipBitmapLockBits(srcBitmap, &area, ImageLockModeRead, format,
&lockeddata_src); &lockeddata_src);

View File

@ -393,8 +393,8 @@ GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, I
if(ret == Ok) if(ret == Ok)
for(i = 0; i < count; i++){ for(i = 0; i < count; i++){
pts[i].X = roundr(ptsF[i].X); pts[i].X = gdip_round(ptsF[i].X);
pts[i].Y = roundr(ptsF[i].Y); pts[i].Y = gdip_round(ptsF[i].Y);
} }
GdipFree(ptsF); GdipFree(ptsF);
@ -474,8 +474,8 @@ GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *
/* store back */ /* store back */
if(ret == Ok) if(ret == Ok)
for(i = 0; i < count; i++){ for(i = 0; i < count; i++){
pts[i].X = roundr(ptsF[i].X); pts[i].X = gdip_round(ptsF[i].X);
pts[i].Y = roundr(ptsF[i].Y); pts[i].Y = gdip_round(ptsF[i].Y);
} }
GdipFree(ptsF); GdipFree(ptsF);

View File

@ -715,10 +715,10 @@ GpStatus WINGDIPAPI GdipGetRegionBoundsI(GpRegion *region, GpGraphics *graphics,
status = GdipGetRegionBounds(region, graphics, &rectf); status = GdipGetRegionBounds(region, graphics, &rectf);
if(status == Ok){ if(status == Ok){
rect->X = roundr(rectf.X); rect->X = gdip_round(rectf.X);
rect->Y = roundr(rectf.X); rect->Y = gdip_round(rectf.X);
rect->Width = roundr(rectf.Width); rect->Width = gdip_round(rectf.Width);
rect->Height = roundr(rectf.Height); rect->Height = gdip_round(rectf.Height);
} }
return status; return status;
@ -1220,7 +1220,7 @@ GpStatus WINGDIPAPI GdipIsVisibleRegionPoint(GpRegion* region, REAL x, REAL y, G
return Ok; return Ok;
} }
*res = PtInRegion(hrgn, roundr(x), roundr(y)); *res = PtInRegion(hrgn, gdip_round(x), gdip_round(y));
DeleteObject(hrgn); DeleteObject(hrgn);