Vincent Povirk : gdiplus: Implement GdipTransformPointsI.

Alexandre Julliard julliard at winehq.org
Wed May 20 08:29:33 CDT 2009


Module: wine
Branch: master
Commit: c486e8147d7906217a71986b762dbe8de9e758df
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c486e8147d7906217a71986b762dbe8de9e758df

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Tue May 19 15:40:43 2009 -0500

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);
 }




More information about the wine-cvs mailing list