From c99b43d4cb62fd05e6e711c106f273f6c65617bb Mon Sep 17 00:00:00 2001 From: Richard Campbell Date: Thu, 27 Mar 2003 03:24:04 +0000 Subject: [PATCH] - Tim Jobling implemented PolyLine svn path=/trunk/; revision=4441 --- reactos/lib/gdi32/misc/stubs.c | 17 +------ reactos/lib/gdi32/objects/line.c | 7 ++- reactos/subsys/win32k/eng/lineto.c | 35 ++++++++++++++ reactos/subsys/win32k/include/inteng.h | 8 ++- reactos/subsys/win32k/objects/line.c | 67 +++++++++++++++++++++++++- 5 files changed, 115 insertions(+), 19 deletions(-) diff --git a/reactos/lib/gdi32/misc/stubs.c b/reactos/lib/gdi32/misc/stubs.c index 997c71a5541..8c464dc412a 100644 --- a/reactos/lib/gdi32/misc/stubs.c +++ b/reactos/lib/gdi32/misc/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.15 2003/03/20 03:04:02 mtempel Exp $ +/* $Id: stubs.c,v 1.16 2003/03/27 03:24:03 rcampbell Exp $ * * reactos/lib/gdi32/misc/stubs.c * @@ -2066,21 +2066,6 @@ DPtoLP( - -BOOL -STDCALL -Polyline( - HDC a0, - CONST POINT *a1, - int a2 - ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - - - BOOL STDCALL PolyBezier( diff --git a/reactos/lib/gdi32/objects/line.c b/reactos/lib/gdi32/objects/line.c index 6e91a626fee..7c456d3a8f4 100644 --- a/reactos/lib/gdi32/objects/line.c +++ b/reactos/lib/gdi32/objects/line.c @@ -21,4 +21,9 @@ MoveToEx(HDC hDC, int X, int Y, LPPOINT Point) return W32kMoveToEx(hDC, X, Y, Point); } - +BOOL +STDCALL +Polyline( HDC hdc, CONST POINT *lppt, int cPoints ) +{ + return W32kPolyline(hdc, (CONST LPPOINT) lppt, cPoints); +} diff --git a/reactos/subsys/win32k/eng/lineto.c b/reactos/subsys/win32k/eng/lineto.c index 179525229b3..a4d2f09e6cd 100644 --- a/reactos/subsys/win32k/eng/lineto.c +++ b/reactos/subsys/win32k/eng/lineto.c @@ -176,3 +176,38 @@ IntEngLineTo(SURFOBJ *DestSurf, return ret; } + +BOOL STDCALL +IntEngPolyline(SURFOBJ *DestSurf, + CLIPOBJ *Clip, + BRUSHOBJ *Brush, + CONST LPPOINT pt, + LONG dCount, + MIX mix) +{ + LONG i; + RECTL rect; + BOOL ret = FALSE; + + //Draw the Polyline with a call to IntEngLineTo for each segment. + for (i=1; iSurface); + BOOL ret; + LONG i; + PPENOBJ pen; + PROSRGNDATA reg; + POINT *pts; + + if (!dc) + return(FALSE); + + if(PATH_IsPathOpen(dc->w.path)) + { + ret = PATH_Polyline(hDC, pt, Count); + } + else + { + pen = (PPENOBJ) GDIOBJ_LockObj(dc->w.hPen, GO_PEN_MAGIC); + reg = (PROSRGNDATA)GDIOBJ_LockObj(dc->w.hGCClipRgn, GO_REGION_MAGIC); + + ASSERT( pen ); + + //FIXME: Do somthing with reg... + + //Allocate "Count" bytes of memory to hold a safe copy of pt + if (!(pts=ExAllocatePool(NonPagedPool, sizeof(POINT) * Count))) + { + GDIOBJ_UnlockObj( dc->w.hGCClipRgn, GO_REGION_MAGIC ); + GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC); + DC_ReleasePtr( hDC ); + return(FALSE); + } + + //safly copy pt to local version + if (STATUS_SUCCESS!=MmCopyFromCaller(pts, pt, sizeof(POINT) * Count)) + { + ExFreePool(pts); + GDIOBJ_UnlockObj( dc->w.hGCClipRgn, GO_REGION_MAGIC ); + GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC); + DC_ReleasePtr( hDC ); + return(FALSE); + } + + //offset the array of point by the dc->w.DCOrg + for(i=0; iw.DCOrgX; + pts[i].y += dc->w.DCOrgY; + } + + //get IntEngPolyline to do the drawing. + ret = IntEngPolyline(SurfObj, + NULL, + PenToBrushObj(dc, pen), + pts, + Count, + dc->w.ROPmode); + + //Clean up + ExFreePool(pts); + GDIOBJ_UnlockObj( dc->w.hGCClipRgn, GO_REGION_MAGIC ); + GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC); + } + + DC_ReleasePtr( hDC ); + return(ret); } BOOL