Module: wine Branch: master Commit: fc313037803a20fc10a99eb70086f762bbd98549 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fc313037803a20fc10a99eb700...
Author: Royal Chan chanroyal@gmail.com Date: Mon Feb 25 21:02:59 2008 -0800
diplus: Implemented GdipDrawArcI based on GdipDrawArc.
---
dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/graphics.c | 21 +++++++++++++++++++ dlls/gdiplus/tests/graphics.c | 45 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletions(-)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index d28de1e..55fabe4 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -153,7 +153,7 @@ @ stdcall GdipDisposeImage(ptr) @ stdcall GdipDisposeImageAttributes(ptr) @ stdcall GdipDrawArc(ptr ptr long long long long long long) -@ stub GdipDrawArcI +@ 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 diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index ebd46aa..bd53102 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -929,6 +929,27 @@ GpStatus WINGDIPAPI GdipDrawArc(GpGraphics *graphics, GpPen *pen, REAL x, return retval; }
+GpStatus WINGDIPAPI GdipDrawArcI(GpGraphics *graphics, GpPen *pen, INT x, + INT y, INT width, INT height, REAL startAngle, REAL sweepAngle) +{ + INT save_state, num_pts; + GpPointF points[MAX_ARC_PTS]; + GpStatus retval; + + if(!graphics || !pen || width <= 0 || height <= 0) + return InvalidParameter; + + num_pts = arc2polybezier(points, x, y, width, height, startAngle, sweepAngle); + + save_state = prepare_dc(graphics, pen); + + retval = draw_polybezier(graphics, pen, points, num_pts, TRUE); + + restore_dc(graphics, save_state); + + return retval; +} + GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4) { diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 826ab67..9edeb91 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -220,6 +220,50 @@ static void test_save_restore(void) ReleaseDC(0, hdc); }
+static void test_GdipDrawArcI(void) +{ + GpStatus status; + GpGraphics *graphics = NULL; + GpPen *pen = NULL; + HDC hdc = GetDC(0); + + /* make a graphics object and pen object */ + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(hdc != NULL, "Expected HDC to be initialized\n"); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(graphics != NULL, "Expected graphics to be initialized\n"); + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen); + expect(Ok, status); + ok(pen != NULL, "Expected pen to be initialized\n"); + + /* InvalidParameter cases: null graphics, null pen, non-positive width, non-positive height */ + status = GdipDrawArcI(NULL, NULL, 0, 0, 0, 0, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawArcI(graphics, NULL, 0, 0, 1, 1, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawArcI(NULL, pen, 0, 0, 1, 1, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawArcI(graphics, pen, 0, 0, 1, 0, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawArcI(graphics, pen, 0, 0, 0, 1, 0, 0); + expect(InvalidParameter, status); + + /* successful case */ + status = GdipDrawArcI(graphics, pen, 0, 0, 1, 1, 0, 0); + expect(Ok, status); + + GdipDeletePen(pen); + ReleaseDC(0, hdc); +} + static void test_GdipDrawBezierI(void) { GpStatus status; @@ -273,6 +317,7 @@ START_TEST(graphics) test_constructor_destructor(); test_save_restore(); test_GdipDrawBezierI(); + test_GdipDrawArcI();
GdiplusShutdown(gdiplusToken); }