[2/2] gdiplus: Implemented GdipDrawBeziers

Nikolay Sivov bunglehead at gmail.com
Wed Jul 2 18:04:50 CDT 2008


Changelog:
    - Implemented GdipDrawBeziers

---
 dlls/gdiplus/gdiplus.spec |    4 +-
 dlls/gdiplus/graphics.c   |   48 +++++++++++++++++++++++++++++++++++++++++++++
 include/gdiplusflat.h     |    2 +
 3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 65154ab..bdc1b90 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -156,8 +156,8 @@
 @ stdcall GdipDrawArcI(ptr ptr long long long long long long)
 @ stdcall GdipDrawBezier(ptr ptr long long long long long long long long)
 @ stdcall GdipDrawBezierI(ptr ptr long long long long long long long long)
-@ stub GdipDrawBeziers
-@ stub GdipDrawBeziersI
+@ stdcall GdipDrawBeziers(ptr ptr ptr long)
+@ stdcall GdipDrawBeziersI(ptr ptr ptr long)
 @ stub GdipDrawCachedBitmap
 @ stub GdipDrawClosedCurve2
 @ stub GdipDrawClosedCurve2I
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index c274b2e..9c0e8d8 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -997,6 +997,54 @@ GpStatus WINGDIPAPI GdipDrawBezierI(GpGraphics *graphics, GpPen *pen, INT x1,
     return retval;
 }
 
+GpStatus WINGDIPAPI GdipDrawBeziers(GpGraphics *graphics, GpPen *pen,
+    GDIPCONST GpPointF *points, INT count)
+{
+    INT i;
+    GpStatus ret;
+
+    if(!graphics || !pen || !points || (count <= 0))
+        return InvalidParameter;
+
+    for(i = 0; i < floor(count / 4); i++){
+        ret = GdipDrawBezier(graphics, pen,
+                             points[4*i].X, points[4*i].Y,
+                             points[4*i + 1].X, points[4*i + 1].Y,
+                             points[4*i + 2].X, points[4*i + 2].Y,
+                             points[4*i + 3].X, points[4*i + 3].Y);
+        if(ret != Ok)
+            return ret;                            
+    }
+    
+    return Ok;
+}
+
+GpStatus WINGDIPAPI GdipDrawBeziersI(GpGraphics *graphics, GpPen *pen,
+    GDIPCONST GpPoint *points, INT count)
+{
+    GpPointF *pts;
+    GpStatus ret;
+    INT i;
+
+    if(!graphics || !pen || !points || (count <= 0))
+        return InvalidParameter;
+
+    pts = GdipAlloc(sizeof(GpPointF) * count);
+    if(!pts)
+        return OutOfMemory;
+
+    for(i = 0; i < count; i++){
+        pts[i].X = (REAL)points[i].X;
+        pts[i].Y = (REAL)points[i].Y;
+    }
+
+    ret = GdipDrawBeziers(graphics,pen,pts,count);
+
+    GdipFree(pts);
+
+    return ret;
+}
+
 GpStatus WINGDIPAPI GdipDrawCurve(GpGraphics *graphics, GpPen *pen,
     GDIPCONST GpPointF *points, INT count)
 {
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 5caeb72..5750420 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -78,6 +78,8 @@ GpStatus WINGDIPAPI GdipDrawArc(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,REAL
 GpStatus WINGDIPAPI GdipDrawArcI(GpGraphics*,GpPen*,INT,INT,INT,INT,REAL,REAL);
 GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,REAL,REAL,REAL);
 GpStatus WINGDIPAPI GdipDrawBezierI(GpGraphics*,GpPen*,INT,INT,INT,INT,INT,INT,INT,INT);
+GpStatus WINGDIPAPI GdipDrawBeziers(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT);
+GpStatus WINGDIPAPI GdipDrawBeziersI(GpGraphics*,GpPen*,GDIPCONST GpPoint*,INT);
 GpStatus WINGDIPAPI GdipDrawCurve(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT);
 GpStatus WINGDIPAPI GdipDrawCurveI(GpGraphics*,GpPen*,GDIPCONST GpPoint*,INT);
 GpStatus WINGDIPAPI GdipDrawCurve2(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT,REAL);
-- 
1.4.4.4






More information about the wine-patches mailing list