From 9c0e92ed6f2312a2deeaf5e3cab04dd6e02e5798 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Tue, 19 May 2009 15:40:43 -0500 Subject: [PATCH] gdiplus: implement GdipTransformPointsI --- dlls/gdiplus/graphics.c | 29 +++++++++++++++++++++++++++-- dlls/gdiplus/tests/graphics.c | 12 ++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 4762669..78700ea 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -3662,9 +3662,34 @@ GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace GpStatus WINGDIPAPI GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPoint *points, INT count) { - FIXME("(%p, %d, %d, %p, %d): stub\n", graphics, dst_space, src_space, points, count); + GpPointF *pointsF; + GpStatus ret; + INT i; - return NotImplemented; + TRACE("(%p, %d, %d, %p, %d)\n", graphics, dst_space, src_space, points, count); + + if(count <= 0) + return InvalidParameter; + + pointsF = GdipAlloc(sizeof(GpPointF) * count); + if(!pointsF) + return OutOfMemory; + + for(i = 0; i < count; i++){ + pointsF[i].X = (REAL)points[i].X; + pointsF[i].Y = (REAL)points[i].Y; + } + + ret = GdipTransformPoints(graphics, dst_space, src_space, pointsF, count); + + if(ret == Ok) + for(i = 0; i < count; i++){ + points[i].X = roundr(pointsF[i].X); + points[i].Y = roundr(pointsF[i].Y); + } + GdipFree(pointsF); + + return ret; } HPALETTE WINGDIPAPI GdipCreateHalftonePalette(void) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 510a148..61143c6 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -770,6 +770,7 @@ static void test_transformpoints(void) GpGraphics *graphics = NULL; HDC hdc = GetDC(0); GpPointF ptf[2]; + GpPoint pt[2]; status = GdipCreateFromHDC(hdc, &graphics); expect(Ok, status); @@ -868,6 +869,17 @@ static void test_transformpoints(void) expectf(0.0, ptf[1].X); expectf(1.0, ptf[1].Y); + pt[0].X = 1; + pt[0].Y = 0; + pt[1].X = 0; + pt[1].Y = 1; + status = GdipTransformPointsI(graphics, CoordinateSpaceDevice, CoordinateSpaceWorld, pt, 2); + expect(Ok, status); + expect(18, pt[0].X); + expect(15, pt[0].Y); + expect(15, pt[1].X); + expect(18, pt[1].Y); + GdipDeleteGraphics(graphics); ReleaseDC(0, hdc); } -- 1.5.4.3