[2/3] gdiplus: fix curve closing in GdipDrawClosedCurve2
Nikolay Sivov
bunglehead at gmail.com
Wed Sep 3 11:43:24 CDT 2008
Changelog:
- fix Bezier curve calculation to connect start and end properly.
GraphicsPath code used to avoid duplication
>From 9a24fe21df66ee7911ad45efd00135b08394d852 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Wed, 3 Sep 2008 19:57:09 +0400
Subject: fix Bezier curve connection on closed curve drawing
---
dlls/gdiplus/graphics.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 7045a34..1265bd7 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -1102,7 +1102,7 @@ GpStatus WINGDIPAPI GdipDrawClosedCurveI(GpGraphics *graphics, GpPen *pen,
GpStatus WINGDIPAPI GdipDrawClosedCurve2(GpGraphics *graphics, GpPen *pen,
GDIPCONST GpPointF *points, INT count, REAL tension)
{
- GpPointF *ptf;
+ GpPath *path;
GpStatus stat;
TRACE("(%p, %p, %p, %d, %.2f)\n", graphics, pen, points, count, tension);
@@ -1113,18 +1113,18 @@ GpStatus WINGDIPAPI GdipDrawClosedCurve2(GpGraphics *graphics, GpPen *pen,
if(graphics->busy)
return ObjectBusy;
- /* make a full points copy.. */
- ptf = GdipAlloc(sizeof(GpPointF)*(count+1));
- if(!ptf)
- return OutOfMemory;
- memcpy(ptf, points, sizeof(GpPointF)*count);
+ if((stat = GdipCreatePath(FillModeAlternate, &path)) != Ok)
+ return stat;
- /* ..and add a first point as a last one */
- ptf[count] = ptf[0];
+ stat = GdipAddPathClosedCurve2(path, points, count, tension);
+ if(stat != Ok){
+ GdipDeletePath(path);
+ return stat;
+ }
- stat = GdipDrawCurve2(graphics, pen, ptf, count + 1, tension);
+ stat = GdipDrawPath(graphics, pen, path);
- GdipFree(ptf);
+ GdipDeletePath(path);
return stat;
}
--
1.4.4.4
More information about the wine-patches
mailing list