mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 14:02:03 +00:00
fixed some gdi functions
svn path=/trunk/; revision=6968
This commit is contained in:
parent
5e5010b3c3
commit
32930c3ec6
4 changed files with 211 additions and 128 deletions
33
reactos/subsys/win32k/include/intgdi.h
Normal file
33
reactos/subsys/win32k/include/intgdi.h
Normal 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 */
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* 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
|
||||
#include <win32k/debug1.h>
|
||||
|
||||
HBRUSH STDCALL NtGdiCreateBrushIndirect(CONST LOGBRUSH *lb)
|
||||
HBRUSH FASTCALL
|
||||
IntGdiCreateBrushIndirect(PLOGBRUSH lb)
|
||||
{
|
||||
PBRUSHOBJ brushPtr;
|
||||
LOGBRUSH Safelb;
|
||||
HBRUSH hBrush;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = MmCopyFromCaller(&Safelb, lb, sizeof(LOGBRUSH));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
hBrush = BRUSHOBJ_AllocBrush();
|
||||
if (hBrush == NULL)
|
||||
{
|
||||
|
@ -59,10 +51,10 @@ HBRUSH STDCALL NtGdiCreateBrushIndirect(CONST LOGBRUSH *lb)
|
|||
/* ASSERT( brushPtr ); *///I want to know if this ever occurs
|
||||
|
||||
if( brushPtr ){
|
||||
brushPtr->iSolidColor = Safelb.lbColor;
|
||||
brushPtr->logbrush.lbStyle = Safelb.lbStyle;
|
||||
brushPtr->logbrush.lbColor = Safelb.lbColor;
|
||||
brushPtr->logbrush.lbHatch = Safelb.lbHatch;
|
||||
brushPtr->iSolidColor = lb->lbColor;
|
||||
brushPtr->logbrush.lbStyle = lb->lbStyle;
|
||||
brushPtr->logbrush.lbColor = lb->lbColor;
|
||||
brushPtr->logbrush.lbHatch = lb->lbHatch;
|
||||
|
||||
BRUSHOBJ_UnlockBrush( hBrush );
|
||||
return hBrush;
|
||||
|
@ -70,10 +62,11 @@ HBRUSH STDCALL NtGdiCreateBrushIndirect(CONST LOGBRUSH *lb)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
HBRUSH STDCALL NtGdiCreateDIBPatternBrush(HGLOBAL hDIBPacked,
|
||||
UINT ColorSpec)
|
||||
HBRUSH FASTCALL
|
||||
IntGdiCreateDIBPatternBrush(HGLOBAL hDIBPacked,
|
||||
UINT ColorSpec)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return NULL;
|
||||
#if 0
|
||||
LOGBRUSH logbrush;
|
||||
PBITMAPINFO info, newInfo;
|
||||
|
@ -106,12 +99,13 @@ HBRUSH STDCALL NtGdiCreateDIBPatternBrush(HGLOBAL hDIBPacked,
|
|||
memcpy(newInfo, info, size);
|
||||
GlobalUnlock16((HGLOBAL16)logbrush.lbHatch);
|
||||
GlobalUnlock(hbitmap);
|
||||
return NtGdiCreateBrushIndirect(&logbrush);
|
||||
return IntGdiCreateBrushIndirect(&logbrush);
|
||||
#endif
|
||||
}
|
||||
|
||||
HBRUSH STDCALL NtGdiCreateDIBPatternBrushPt(CONST VOID *PackedDIB,
|
||||
UINT Usage)
|
||||
HBRUSH FASTCALL
|
||||
IntGdiCreateDIBPatternBrushPt(CONST VOID *PackedDIB,
|
||||
UINT Usage)
|
||||
{
|
||||
INT size;
|
||||
LOGBRUSH logbrush;
|
||||
|
@ -155,66 +149,17 @@ HBRUSH STDCALL NtGdiCreateDIBPatternBrushPt(CONST VOID *PackedDIB,
|
|||
memcpy(newInfo, info, size);
|
||||
GDIOBJ_UnlockObj((HGDIOBJ) logbrush.lbHatch, GDI_OBJECT_TYPE_DONTCARE);
|
||||
|
||||
return NtGdiCreateBrushIndirect (&logbrush);
|
||||
return IntGdiCreateBrushIndirect (&logbrush);
|
||||
}
|
||||
|
||||
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 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)
|
||||
BOOL FASTCALL
|
||||
IntPatBlt(DC *dc,
|
||||
INT XLeft,
|
||||
INT YLeft,
|
||||
INT Width,
|
||||
INT Height,
|
||||
DWORD ROP,
|
||||
PBRUSHOBJ BrushObj)
|
||||
{
|
||||
RECT DestRect;
|
||||
PSURFOBJ SurfObj;
|
||||
|
@ -266,17 +211,127 @@ BOOL STDCALL IntPatBlt(DC *dc,
|
|||
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,
|
||||
DWORD dwRop,
|
||||
PPATRECT pRects,
|
||||
int cRects,
|
||||
ULONG Reserved)
|
||||
{
|
||||
int i;
|
||||
PPATRECT r, rb;
|
||||
PBRUSHOBJ BrushObj;
|
||||
DC *dc;
|
||||
PPATRECT rb;
|
||||
NTSTATUS Status;
|
||||
BOOL Ret;
|
||||
|
||||
if(cRects > 0)
|
||||
{
|
||||
|
@ -295,27 +350,11 @@ BOOL STDCALL NtGdiPolyPatBlt(HDC hDC,
|
|||
}
|
||||
}
|
||||
|
||||
dc = DC_LockDc(hDC);
|
||||
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 );
|
||||
Ret = IntGdiPolyPatBlt(hDC, dwRop, pRects, cRects, Reserved);
|
||||
|
||||
if(cRects > 0)
|
||||
ExFreePool(rb);
|
||||
return TRUE;
|
||||
return Ret;
|
||||
}
|
||||
|
||||
BOOL STDCALL NtGdiPatBlt(HDC hDC,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
/*
|
||||
* 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/cursoricon.h>
|
||||
#include <include/palette.h>
|
||||
#include <include/intgdi.h>
|
||||
#define NDEBUG
|
||||
#include <win32k/debug1.h>
|
||||
|
||||
|
@ -476,16 +477,16 @@ CreateStockObjects(void)
|
|||
|
||||
/* Create GDI Stock Objects from the logical structures we've defined */
|
||||
|
||||
StockObjects[WHITE_BRUSH] = NtGdiCreateBrushIndirect(&WhiteBrush);
|
||||
StockObjects[LTGRAY_BRUSH] = NtGdiCreateBrushIndirect(&LtGrayBrush);
|
||||
StockObjects[GRAY_BRUSH] = NtGdiCreateBrushIndirect(&GrayBrush);
|
||||
StockObjects[DKGRAY_BRUSH] = NtGdiCreateBrushIndirect(&DkGrayBrush);
|
||||
StockObjects[BLACK_BRUSH] = NtGdiCreateBrushIndirect(&BlackBrush);
|
||||
StockObjects[NULL_BRUSH] = NtGdiCreateBrushIndirect(&NullBrush);
|
||||
StockObjects[WHITE_BRUSH] = IntGdiCreateBrushIndirect(&WhiteBrush);
|
||||
StockObjects[LTGRAY_BRUSH] = IntGdiCreateBrushIndirect(&LtGrayBrush);
|
||||
StockObjects[GRAY_BRUSH] = IntGdiCreateBrushIndirect(&GrayBrush);
|
||||
StockObjects[DKGRAY_BRUSH] = IntGdiCreateBrushIndirect(&DkGrayBrush);
|
||||
StockObjects[BLACK_BRUSH] = IntGdiCreateBrushIndirect(&BlackBrush);
|
||||
StockObjects[NULL_BRUSH] = IntGdiCreateBrushIndirect(&NullBrush);
|
||||
|
||||
StockObjects[WHITE_PEN] = NtGdiCreatePenIndirect(&WhitePen);
|
||||
StockObjects[BLACK_PEN] = NtGdiCreatePenIndirect(&BlackPen);
|
||||
StockObjects[NULL_PEN] = NtGdiCreatePenIndirect(&NullPen);
|
||||
StockObjects[WHITE_PEN] = IntGdiCreatePenIndirect(&WhitePen);
|
||||
StockObjects[BLACK_PEN] = IntGdiCreatePenIndirect(&BlackPen);
|
||||
StockObjects[NULL_PEN] = IntGdiCreatePenIndirect(&NullPen);
|
||||
|
||||
(void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]);
|
||||
(void) TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* 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
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
@ -27,6 +27,30 @@
|
|||
#define NDEBUG
|
||||
#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
|
||||
STDCALL
|
||||
NtGdiCreatePen(INT PenStyle, INT Width, COLORREF Color)
|
||||
|
@ -38,16 +62,14 @@ NtGdiCreatePen(INT PenStyle, INT Width, COLORREF Color)
|
|||
logpen.lopnWidth.y = 0;
|
||||
logpen.lopnColor = Color;
|
||||
|
||||
return NtGdiCreatePenIndirect(&logpen);
|
||||
return IntGdiCreatePenIndirect(&logpen);
|
||||
}
|
||||
|
||||
HPEN
|
||||
STDCALL
|
||||
NtGdiCreatePenIndirect(CONST PLOGPEN lgpn)
|
||||
{
|
||||
PPENOBJ penPtr;
|
||||
LOGPEN Safelgpn;
|
||||
HPEN hpen;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = MmCopyFromCaller(&Safelgpn, lgpn, sizeof(LOGPEN));
|
||||
|
@ -57,19 +79,7 @@ NtGdiCreatePenIndirect(CONST PLOGPEN lgpn)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (Safelgpn.lopnStyle > PS_INSIDEFRAME) return 0;
|
||||
|
||||
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;
|
||||
return IntGdiCreatePenIndirect(&Safelgpn);
|
||||
}
|
||||
|
||||
HPEN
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue