fixed some gdi functions

svn path=/trunk/; revision=6968
This commit is contained in:
Thomas Bluemel 2003-12-12 15:47:37 +00:00
parent 5e5010b3c3
commit 32930c3ec6
4 changed files with 211 additions and 128 deletions

View file

@ -0,0 +1,33 @@
#ifndef _WIN32K_INTGDI_H
#define _WIN32K_INTGDI_H
/* Brush functions */
HBRUSH FASTCALL
IntGdiCreateBrushIndirect(PLOGBRUSH lb);
HBRUSH FASTCALL
IntGdiCreateDIBPatternBrush(HGLOBAL hDIBPacked,
UINT ColorSpec);
HBRUSH FASTCALL
IntGdiCreateDIBPatternBrushPt(CONST VOID *PackedDIB,
UINT Usage);
BOOL FASTCALL
IntPatBlt(DC *dc,
INT XLeft,
INT YLeft,
INT Width,
INT Height,
DWORD ROP,
PBRUSHOBJ BrushObj);
/* Pen functions */
HPEN FASTCALL
IntGdiCreatePenIndirect(PLOGPEN lgpn);
#endif /* _WIN32K_INTGDI_H */

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.29 2003/12/11 15:14:40 weiden Exp $ /* $Id: brush.c,v 1.30 2003/12/12 15:47:37 weiden Exp $
*/ */
@ -34,20 +34,12 @@
#define NDEBUG #define NDEBUG
#include <win32k/debug1.h> #include <win32k/debug1.h>
HBRUSH STDCALL NtGdiCreateBrushIndirect(CONST LOGBRUSH *lb) HBRUSH FASTCALL
IntGdiCreateBrushIndirect(PLOGBRUSH 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)
{ {
@ -59,10 +51,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 = Safelb.lbColor; brushPtr->iSolidColor = lb->lbColor;
brushPtr->logbrush.lbStyle = Safelb.lbStyle; brushPtr->logbrush.lbStyle = lb->lbStyle;
brushPtr->logbrush.lbColor = Safelb.lbColor; brushPtr->logbrush.lbColor = lb->lbColor;
brushPtr->logbrush.lbHatch = Safelb.lbHatch; brushPtr->logbrush.lbHatch = lb->lbHatch;
BRUSHOBJ_UnlockBrush( hBrush ); BRUSHOBJ_UnlockBrush( hBrush );
return hBrush; return hBrush;
@ -70,10 +62,11 @@ HBRUSH STDCALL NtGdiCreateBrushIndirect(CONST LOGBRUSH *lb)
return NULL; return NULL;
} }
HBRUSH STDCALL NtGdiCreateDIBPatternBrush(HGLOBAL hDIBPacked, HBRUSH FASTCALL
UINT ColorSpec) IntGdiCreateDIBPatternBrush(HGLOBAL hDIBPacked,
UINT ColorSpec)
{ {
UNIMPLEMENTED; return NULL;
#if 0 #if 0
LOGBRUSH logbrush; LOGBRUSH logbrush;
PBITMAPINFO info, newInfo; PBITMAPINFO info, newInfo;
@ -106,12 +99,13 @@ HBRUSH STDCALL NtGdiCreateDIBPatternBrush(HGLOBAL hDIBPacked,
memcpy(newInfo, info, size); memcpy(newInfo, info, size);
GlobalUnlock16((HGLOBAL16)logbrush.lbHatch); GlobalUnlock16((HGLOBAL16)logbrush.lbHatch);
GlobalUnlock(hbitmap); GlobalUnlock(hbitmap);
return NtGdiCreateBrushIndirect(&logbrush); return IntGdiCreateBrushIndirect(&logbrush);
#endif #endif
} }
HBRUSH STDCALL NtGdiCreateDIBPatternBrushPt(CONST VOID *PackedDIB, HBRUSH FASTCALL
UINT Usage) IntGdiCreateDIBPatternBrushPt(CONST VOID *PackedDIB,
UINT Usage)
{ {
INT size; INT size;
LOGBRUSH logbrush; LOGBRUSH logbrush;
@ -155,66 +149,17 @@ HBRUSH STDCALL NtGdiCreateDIBPatternBrushPt(CONST VOID *PackedDIB,
memcpy(newInfo, info, size); memcpy(newInfo, info, size);
GDIOBJ_UnlockObj((HGDIOBJ) logbrush.lbHatch, GDI_OBJECT_TYPE_DONTCARE); GDIOBJ_UnlockObj((HGDIOBJ) logbrush.lbHatch, GDI_OBJECT_TYPE_DONTCARE);
return NtGdiCreateBrushIndirect (&logbrush); return IntGdiCreateBrushIndirect (&logbrush);
} }
HBRUSH STDCALL NtGdiCreateHatchBrush(INT Style, BOOL FASTCALL
COLORREF Color) IntPatBlt(DC *dc,
{ INT XLeft,
LOGBRUSH logbrush; INT YLeft,
INT Width,
DPRINT("%d %06lx\n", Style, Color); INT Height,
DWORD ROP,
if (Style < 0 || Style >= NB_HATCH_STYLES) PBRUSHOBJ BrushObj)
{
return 0;
}
logbrush.lbStyle = BS_HATCHED;
logbrush.lbColor = Color;
logbrush.lbHatch = Style;
return NtGdiCreateBrushIndirect (&logbrush);
}
HBRUSH STDCALL NtGdiCreatePatternBrush(HBITMAP hBitmap)
{
LOGBRUSH logbrush = { BS_PATTERN, 0, 0 };
DPRINT ("%04x\n", hBitmap);
logbrush.lbHatch = (INT) BITMAPOBJ_CopyBitmap (hBitmap);
if(!logbrush.lbHatch)
{
return 0;
}
else
{
return NtGdiCreateBrushIndirect( &logbrush );
}
}
HBRUSH STDCALL NtGdiCreateSolidBrush(COLORREF Color)
{
LOGBRUSH logbrush;
logbrush.lbStyle = BS_SOLID;
logbrush.lbColor = Color;
logbrush.lbHatch = 0;
return NtGdiCreateBrushIndirect(&logbrush);
}
BOOL STDCALL NtGdiFixBrushOrgEx(VOID)
{
return FALSE;
}
BOOL STDCALL IntPatBlt(DC *dc,
INT XLeft,
INT YLeft,
INT Width,
INT Height,
DWORD ROP,
PBRUSHOBJ BrushObj)
{ {
RECT DestRect; RECT DestRect;
PSURFOBJ SurfObj; PSURFOBJ SurfObj;
@ -266,17 +211,127 @@ BOOL STDCALL IntPatBlt(DC *dc,
return ret; return ret;
} }
BOOL FASTCALL
IntGdiPolyPatBlt(HDC hDC,
DWORD dwRop,
PPATRECT pRects,
int cRects,
ULONG Reserved)
{
int i;
PPATRECT r;
PBRUSHOBJ BrushObj;
DC *dc;
dc = DC_LockDc(hDC);
if (dc == NULL)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return(FALSE);
}
for (r = pRects, i = 0; i < cRects; i++)
{
BrushObj = BRUSHOBJ_LockBrush(r->hBrush);
IntPatBlt(dc,r->r.left,r->r.top,r->r.right,r->r.bottom,dwRop,BrushObj);
BRUSHOBJ_UnlockBrush(r->hBrush);
r++;
}
DC_UnlockDc( hDC );
return(TRUE);
}
/******************************************************************************/
HBRUSH STDCALL NtGdiCreateBrushIndirect(CONST LOGBRUSH *lb)
{
LOGBRUSH Safelb;
NTSTATUS Status;
Status = MmCopyFromCaller(&Safelb, lb, sizeof(LOGBRUSH));
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);
return 0;
}
return IntGdiCreateBrushIndirect(&Safelb);
}
HBRUSH STDCALL NtGdiCreateDIBPatternBrush(HGLOBAL hDIBPacked,
UINT ColorSpec)
{
/* IntGdiCreateDIBPatternBrush() */
UNIMPLEMENTED;
}
HBRUSH STDCALL NtGdiCreateDIBPatternBrushPt(CONST VOID *PackedDIB,
UINT Usage)
{
/* FIXME - copy PackedDIB memory first! */
return IntGdiCreateDIBPatternBrushPt(PackedDIB, Usage);
}
HBRUSH STDCALL NtGdiCreateHatchBrush(INT Style,
COLORREF Color)
{
LOGBRUSH logbrush;
DPRINT("%d %06lx\n", Style, Color);
if (Style < 0 || Style >= NB_HATCH_STYLES)
{
return 0;
}
logbrush.lbStyle = BS_HATCHED;
logbrush.lbColor = Color;
logbrush.lbHatch = Style;
return IntGdiCreateBrushIndirect (&logbrush);
}
HBRUSH STDCALL NtGdiCreatePatternBrush(HBITMAP hBitmap)
{
LOGBRUSH logbrush = { BS_PATTERN, 0, 0 };
DPRINT ("%04x\n", hBitmap);
logbrush.lbHatch = (INT) BITMAPOBJ_CopyBitmap (hBitmap);
if(!logbrush.lbHatch)
{
return 0;
}
else
{
return IntGdiCreateBrushIndirect( &logbrush );
}
}
HBRUSH STDCALL NtGdiCreateSolidBrush(COLORREF Color)
{
LOGBRUSH logbrush;
logbrush.lbStyle = BS_SOLID;
logbrush.lbColor = Color;
logbrush.lbHatch = 0;
return IntGdiCreateBrushIndirect(&logbrush);
}
BOOL STDCALL NtGdiFixBrushOrgEx(VOID)
{
return FALSE;
}
BOOL STDCALL NtGdiPolyPatBlt(HDC hDC, BOOL STDCALL NtGdiPolyPatBlt(HDC hDC,
DWORD dwRop, DWORD dwRop,
PPATRECT pRects, PPATRECT pRects,
int cRects, int cRects,
ULONG Reserved) ULONG Reserved)
{ {
int i; PPATRECT rb;
PPATRECT r, rb;
PBRUSHOBJ BrushObj;
DC *dc;
NTSTATUS Status; NTSTATUS Status;
BOOL Ret;
if(cRects > 0) if(cRects > 0)
{ {
@ -295,27 +350,11 @@ BOOL STDCALL NtGdiPolyPatBlt(HDC hDC,
} }
} }
dc = DC_LockDc(hDC); Ret = IntGdiPolyPatBlt(hDC, dwRop, pRects, cRects, Reserved);
if (dc == NULL)
{
if(cRects > 0)
ExFreePool(rb);
SetLastWin32Error(ERROR_INVALID_HANDLE);
return(FALSE);
}
for (r = rb, i = 0; i < cRects; i++)
{
BrushObj = BRUSHOBJ_LockBrush(r->hBrush);
IntPatBlt(dc,r->r.left,r->r.top,r->r.right,r->r.bottom,dwRop,BrushObj);
BRUSHOBJ_UnlockBrush(r->hBrush);
r++;
}
DC_UnlockDc( hDC );
if(cRects > 0) if(cRects > 0)
ExFreePool(rb); ExFreePool(rb);
return TRUE; return Ret;
} }
BOOL STDCALL NtGdiPatBlt(HDC hDC, BOOL STDCALL NtGdiPatBlt(HDC hDC,

View file

@ -19,7 +19,7 @@
/* /*
* GDIOBJ.C - GDI object manipulation routines * GDIOBJ.C - GDI object manipulation routines
* *
* $Id: gdiobj.c,v 1.52 2003/11/26 21:48:35 gvg Exp $ * $Id: gdiobj.c,v 1.53 2003/12/12 15:47:37 weiden Exp $
* *
*/ */
@ -38,6 +38,7 @@
#include <win32k/region.h> #include <win32k/region.h>
#include <win32k/cursoricon.h> #include <win32k/cursoricon.h>
#include <include/palette.h> #include <include/palette.h>
#include <include/intgdi.h>
#define NDEBUG #define NDEBUG
#include <win32k/debug1.h> #include <win32k/debug1.h>
@ -476,16 +477,16 @@ CreateStockObjects(void)
/* Create GDI Stock Objects from the logical structures we've defined */ /* Create GDI Stock Objects from the logical structures we've defined */
StockObjects[WHITE_BRUSH] = NtGdiCreateBrushIndirect(&WhiteBrush); StockObjects[WHITE_BRUSH] = IntGdiCreateBrushIndirect(&WhiteBrush);
StockObjects[LTGRAY_BRUSH] = NtGdiCreateBrushIndirect(&LtGrayBrush); StockObjects[LTGRAY_BRUSH] = IntGdiCreateBrushIndirect(&LtGrayBrush);
StockObjects[GRAY_BRUSH] = NtGdiCreateBrushIndirect(&GrayBrush); StockObjects[GRAY_BRUSH] = IntGdiCreateBrushIndirect(&GrayBrush);
StockObjects[DKGRAY_BRUSH] = NtGdiCreateBrushIndirect(&DkGrayBrush); StockObjects[DKGRAY_BRUSH] = IntGdiCreateBrushIndirect(&DkGrayBrush);
StockObjects[BLACK_BRUSH] = NtGdiCreateBrushIndirect(&BlackBrush); StockObjects[BLACK_BRUSH] = IntGdiCreateBrushIndirect(&BlackBrush);
StockObjects[NULL_BRUSH] = NtGdiCreateBrushIndirect(&NullBrush); StockObjects[NULL_BRUSH] = IntGdiCreateBrushIndirect(&NullBrush);
StockObjects[WHITE_PEN] = NtGdiCreatePenIndirect(&WhitePen); StockObjects[WHITE_PEN] = IntGdiCreatePenIndirect(&WhitePen);
StockObjects[BLACK_PEN] = NtGdiCreatePenIndirect(&BlackPen); StockObjects[BLACK_PEN] = IntGdiCreatePenIndirect(&BlackPen);
StockObjects[NULL_PEN] = NtGdiCreatePenIndirect(&NullPen); StockObjects[NULL_PEN] = IntGdiCreatePenIndirect(&NullPen);
(void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]); (void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]);
(void) TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]); (void) TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]);

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: pen.c,v 1.12 2003/12/11 14:48:55 weiden Exp $ */ /* $Id: pen.c,v 1.13 2003/12/12 15:47:37 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
@ -27,6 +27,30 @@
#define NDEBUG #define NDEBUG
#include <win32k/debug1.h> #include <win32k/debug1.h>
HPEN FASTCALL
IntGdiCreatePenIndirect(PLOGPEN lgpn)
{
HPEN hpen;
PPENOBJ penPtr;
if (lgpn->lopnStyle > PS_INSIDEFRAME) return 0;
hpen = PENOBJ_AllocPen();
if (!hpen) return 0;
penPtr = PENOBJ_LockPen( hpen );
ASSERT( penPtr );
penPtr->logpen.lopnStyle = lgpn->lopnStyle;
penPtr->logpen.lopnWidth = lgpn->lopnWidth;
penPtr->logpen.lopnColor = lgpn->lopnColor;
PENOBJ_UnlockPen( hpen );
return hpen;
}
/******************************************************************************/
HPEN HPEN
STDCALL STDCALL
NtGdiCreatePen(INT PenStyle, INT Width, COLORREF Color) NtGdiCreatePen(INT PenStyle, INT Width, COLORREF Color)
@ -38,16 +62,14 @@ NtGdiCreatePen(INT PenStyle, INT Width, COLORREF Color)
logpen.lopnWidth.y = 0; logpen.lopnWidth.y = 0;
logpen.lopnColor = Color; logpen.lopnColor = Color;
return NtGdiCreatePenIndirect(&logpen); return IntGdiCreatePenIndirect(&logpen);
} }
HPEN HPEN
STDCALL STDCALL
NtGdiCreatePenIndirect(CONST PLOGPEN lgpn) NtGdiCreatePenIndirect(CONST PLOGPEN lgpn)
{ {
PPENOBJ penPtr;
LOGPEN Safelgpn; LOGPEN Safelgpn;
HPEN hpen;
NTSTATUS Status; NTSTATUS Status;
Status = MmCopyFromCaller(&Safelgpn, lgpn, sizeof(LOGPEN)); Status = MmCopyFromCaller(&Safelgpn, lgpn, sizeof(LOGPEN));
@ -57,19 +79,7 @@ NtGdiCreatePenIndirect(CONST PLOGPEN lgpn)
return 0; return 0;
} }
if (Safelgpn.lopnStyle > PS_INSIDEFRAME) return 0; return IntGdiCreatePenIndirect(&Safelgpn);
hpen = PENOBJ_AllocPen();
if (!hpen) return 0;
penPtr = PENOBJ_LockPen( hpen );
ASSERT( penPtr );
penPtr->logpen.lopnStyle = Safelgpn.lopnStyle;
penPtr->logpen.lopnWidth = Safelgpn.lopnWidth;
penPtr->logpen.lopnColor = Safelgpn.lopnColor;
PENOBJ_UnlockPen( hpen );
return hpen;
} }
HPEN HPEN