- Fixed buffer handling and coordinate translation in IntGdiPolyline.

svn path=/trunk/; revision=9986
This commit is contained in:
Filip Navara 2004-07-03 22:36:01 +00:00
parent 4d9b237e6d
commit 0c94f9e2c2

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: line.c,v 1.35 2004/07/03 17:40:27 navaraf Exp $ */ /* $Id: line.c,v 1.36 2004/07/03 22:36:01 navaraf Exp $ */
#include <w32k.h> #include <w32k.h>
// Some code from the WINE project source (www.winehq.com) // Some code from the WINE project source (www.winehq.com)
@ -188,56 +188,53 @@ IntGdiPolyline(DC *dc,
LPPOINT pt, LPPOINT pt,
int Count) int Count)
{ {
BITMAPOBJ *BitmapObj; BITMAPOBJ *BitmapObj;
BOOL ret = FALSE; // default to failure GDIBRUSHOBJ *PenBrushObj;
LONG i; LPPOINT Points;
PGDIBRUSHOBJ PenBrushObj; BOOL Ret = TRUE;
POINT *pts; LONG i;
if ( PATH_IsPathOpen ( dc->w.path ) ) if (PATH_IsPathOpen(dc->w.path))
return PATH_Polyline ( dc, pt, Count ); return PATH_Polyline(dc, pt, Count);
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap); /* Get BRUSHOBJ from current pen. */
ASSERT(BitmapObj); PenBrushObj = PENOBJ_LockPen(dc->w.hPen);
ASSERT(PenBrushObj);
//Allocate "Count" bytes of memory to hold a safe copy of pt if (!(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
pts = (POINT*)ExAllocatePoolWithTag ( PagedPool, sizeof(POINT)*Count, TAG_SHAPE ); {
if ( pts ) Points = EngAllocMem(0, Count * sizeof(POINT), TAG_COORD);
{ if (Points != NULL)
// safely copy pt to local version
if ( STATUS_SUCCESS == MmCopyFromCaller(pts, pt, sizeof(POINT)*Count) )
{
//offset the array of point by the dc->w.DCOrg
for ( i = 0; i < Count; i++ )
{ {
pts[i].x += dc->w.DCOrgX; BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
pts[i].y += dc->w.DCOrgY; ASSERT(BitmapObj);
RtlCopyMemory(Points, pt, Count * sizeof(POINT));
IntLPtoDP(dc, Points, Count);
/* Offset the array of point by the dc->w.DCOrg */
for (i = 0; i < Count; i++)
{
Points[i].x += dc->w.DCOrgX;
Points[i].y += dc->w.DCOrgY;
}
Ret = IntEngPolyline(BitmapObj, dc->CombinedClip,
&PenBrushObj->BrushObject, Points, Count,
dc->w.ROPmode);
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
EngFreeMem(Points);
} }
else
/* get BRUSHOBJ from current pen. */
PenBrushObj = PENOBJ_LockPen( dc->w.hPen );
ASSERT(PenBrushObj);
if (!(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
{ {
//get IntEngPolyline to do the drawing. Ret = FALSE;
ret = IntEngPolyline(BitmapObj,
dc->CombinedClip,
&PenBrushObj->BrushObject,
pts,
Count,
dc->w.ROPmode);
} }
}
PENOBJ_UnlockPen( dc->w.hPen ); PENOBJ_UnlockPen(dc->w.hPen);
}
ExFreePool ( pts ); return Ret;
}
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
return ret;
} }
BOOL FASTCALL BOOL FASTCALL