mirror of
https://github.com/reactos/reactos.git
synced 2025-01-07 23:05:03 +00:00
- Fixed buffer handling and coordinate translation in IntGdiPolyline.
svn path=/trunk/; revision=9986
This commit is contained in:
parent
4d9b237e6d
commit
0c94f9e2c2
1 changed files with 39 additions and 42 deletions
|
@ -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)
|
||||||
|
@ -189,55 +189,52 @@ IntGdiPolyline(DC *dc,
|
||||||
int Count)
|
int Count)
|
||||||
{
|
{
|
||||||
BITMAPOBJ *BitmapObj;
|
BITMAPOBJ *BitmapObj;
|
||||||
BOOL ret = FALSE; // default to failure
|
GDIBRUSHOBJ *PenBrushObj;
|
||||||
|
LPPOINT Points;
|
||||||
|
BOOL Ret = TRUE;
|
||||||
LONG i;
|
LONG i;
|
||||||
PGDIBRUSHOBJ PenBrushObj;
|
|
||||||
POINT *pts;
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
//Allocate "Count" bytes of memory to hold a safe copy of pt
|
|
||||||
pts = (POINT*)ExAllocatePoolWithTag ( PagedPool, sizeof(POINT)*Count, TAG_SHAPE );
|
|
||||||
if ( pts )
|
|
||||||
{
|
|
||||||
// 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;
|
|
||||||
pts[i].y += dc->w.DCOrgY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get BRUSHOBJ from current pen. */
|
|
||||||
PenBrushObj = PENOBJ_LockPen( dc->w.hPen );
|
|
||||||
ASSERT(PenBrushObj);
|
ASSERT(PenBrushObj);
|
||||||
|
|
||||||
if (!(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
|
if (!(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
|
||||||
{
|
{
|
||||||
//get IntEngPolyline to do the drawing.
|
Points = EngAllocMem(0, Count * sizeof(POINT), TAG_COORD);
|
||||||
ret = IntEngPolyline(BitmapObj,
|
if (Points != NULL)
|
||||||
dc->CombinedClip,
|
{
|
||||||
&PenBrushObj->BrushObject,
|
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
|
||||||
pts,
|
ASSERT(BitmapObj);
|
||||||
Count,
|
|
||||||
|
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);
|
dc->w.ROPmode);
|
||||||
}
|
|
||||||
|
|
||||||
PENOBJ_UnlockPen( dc->w.hPen );
|
|
||||||
}
|
|
||||||
|
|
||||||
ExFreePool ( pts );
|
|
||||||
}
|
|
||||||
|
|
||||||
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
|
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
|
||||||
|
EngFreeMem(Points);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Ret = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
PENOBJ_UnlockPen(dc->w.hPen);
|
||||||
|
|
||||||
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
|
|
Loading…
Reference in a new issue