fixed NtGdiCreateBrushIndirect() and NtGdiPolyPatBlt()

svn path=/trunk/; revision=6957
This commit is contained in:
Thomas Bluemel 2003-12-11 15:14:40 +00:00
parent 8e00d905ca
commit 24e3b63b61

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: brush.c,v 1.28 2003/11/24 21:20:35 gvg Exp $ /* $Id: brush.c,v 1.29 2003/12/11 15:14:40 weiden Exp $
*/ */
@ -25,6 +25,7 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <win32k/bitmaps.h> #include <win32k/bitmaps.h>
#include <win32k/brush.h> #include <win32k/brush.h>
#include <internal/safe.h>
//#include <win32k/debug.h> //#include <win32k/debug.h>
#include <include/object.h> #include <include/object.h>
#include <include/inteng.h> #include <include/inteng.h>
@ -36,7 +37,16 @@
HBRUSH STDCALL NtGdiCreateBrushIndirect(CONST LOGBRUSH *lb) HBRUSH STDCALL NtGdiCreateBrushIndirect(CONST LOGBRUSH *lb)
{ {
PBRUSHOBJ brushPtr; PBRUSHOBJ brushPtr;
LOGBRUSH Safelb;
HBRUSH hBrush; HBRUSH hBrush;
NTSTATUS Status;
Status = MmCopyFromCaller(&Safelb, lb, sizeof(LOGBRUSH));
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);
return 0;
}
hBrush = BRUSHOBJ_AllocBrush(); hBrush = BRUSHOBJ_AllocBrush();
if (hBrush == NULL) if (hBrush == NULL)
@ -49,10 +59,10 @@ HBRUSH STDCALL NtGdiCreateBrushIndirect(CONST LOGBRUSH *lb)
/* ASSERT( brushPtr ); *///I want to know if this ever occurs /* ASSERT( brushPtr ); *///I want to know if this ever occurs
if( brushPtr ){ if( brushPtr ){
brushPtr->iSolidColor = lb->lbColor; brushPtr->iSolidColor = Safelb.lbColor;
brushPtr->logbrush.lbStyle = lb->lbStyle; brushPtr->logbrush.lbStyle = Safelb.lbStyle;
brushPtr->logbrush.lbColor = lb->lbColor; brushPtr->logbrush.lbColor = Safelb.lbColor;
brushPtr->logbrush.lbHatch = lb->lbHatch; brushPtr->logbrush.lbHatch = Safelb.lbHatch;
BRUSHOBJ_UnlockBrush( hBrush ); BRUSHOBJ_UnlockBrush( hBrush );
return hBrush; return hBrush;
@ -263,23 +273,48 @@ BOOL STDCALL NtGdiPolyPatBlt(HDC hDC,
ULONG Reserved) ULONG Reserved)
{ {
int i; int i;
PATRECT r; PPATRECT r, rb;
PBRUSHOBJ BrushObj; PBRUSHOBJ BrushObj;
DC *dc = DC_LockDc(hDC); DC *dc;
NTSTATUS Status;
if(cRects > 0)
{
rb = ExAllocatePool(PagedPool, sizeof(PATRECT) * cRects);
if(!rb)
{
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
Status = MmCopyFromCaller(rb, pRects, sizeof(PATRECT) * cRects);
if(!NT_SUCCESS(Status))
{
ExFreePool(rb);
SetLastNtError(Status);
return FALSE;
}
}
dc = DC_LockDc(hDC);
if (dc == NULL) if (dc == NULL)
{ {
if(cRects > 0)
ExFreePool(rb);
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return(FALSE); return(FALSE);
} }
for (i = 0;i<cRects;i++)
for (r = rb, i = 0; i < cRects; i++)
{ {
r = *pRects; BrushObj = BRUSHOBJ_LockBrush(r->hBrush);
BrushObj = BRUSHOBJ_LockBrush(r.hBrush); IntPatBlt(dc,r->r.left,r->r.top,r->r.right,r->r.bottom,dwRop,BrushObj);
IntPatBlt(dc,r.r.left,r.r.top,r.r.right,r.r.bottom,dwRop,BrushObj); BRUSHOBJ_UnlockBrush(r->hBrush);
BRUSHOBJ_UnlockBrush(r.hBrush); r++;
pRects++;
} }
DC_UnlockDc( hDC ); DC_UnlockDc( hDC );
if(cRects > 0)
ExFreePool(rb);
return TRUE; return TRUE;
} }