mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
- Tim Jobling implemented PolyLine
svn path=/trunk/; revision=4441
This commit is contained in:
parent
9588279d27
commit
c99b43d4cb
5 changed files with 115 additions and 19 deletions
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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; i<dCount; i++)
|
||||
{
|
||||
rect.left = MIN(pt[i-1].x, pt[i].x);
|
||||
rect.top = MIN(pt[i-1].y, pt[i].y);
|
||||
rect.right = MAX(pt[i-1].x, pt[i].x);
|
||||
rect.bottom = MAX(pt[i-1].y, pt[i].y);
|
||||
ret = IntEngLineTo(DestSurf,
|
||||
Clip,
|
||||
Brush,
|
||||
pt[i-1].x,
|
||||
pt[i-1].y,
|
||||
pt[i].x,
|
||||
pt[i].y,
|
||||
&rect,
|
||||
mix);
|
||||
if (!ret)
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -28,5 +28,11 @@ XLATEOBJ *IntEngCreateXlate(USHORT DestPalType,
|
|||
USHORT SourcePalType,
|
||||
HPALETTE PaletteDest,
|
||||
HPALETTE PaletteSource);
|
||||
|
||||
|
||||
extern BOOL STDCALL IntEngPolyline(SURFOBJ *DestSurf,
|
||||
CLIPOBJ *Clip,
|
||||
BRUSHOBJ *Brush,
|
||||
CONST LPPOINT pt,
|
||||
LONG dCount,
|
||||
MIX mix);
|
||||
#endif
|
||||
|
|
|
@ -259,7 +259,72 @@ W32kPolyline(HDC hDC,
|
|||
CONST LPPOINT pt,
|
||||
int Count)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
DC *dc = DC_HandleToPtr(hDC);
|
||||
SURFOBJ *SurfObj = (SURFOBJ*)AccessUserObject(dc->Surface);
|
||||
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; i<Count; i++)
|
||||
{
|
||||
pts[i].x += dc->w.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
|
||||
|
|
Loading…
Reference in a new issue