Don't reinitialize the VGA on an enable surface if it is already initialized

Implemented patblt and rectangle fill
Offset drawing by the origin of the DC
Other GUI fixes

svn path=/trunk/; revision=3450
This commit is contained in:
David Welch 2002-09-01 20:39:56 +00:00
parent a8c82f2bfb
commit b163519757
30 changed files with 702 additions and 328 deletions

View file

@ -19,7 +19,7 @@ WinMain(HINSTANCE hInstance,
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;

View file

@ -1,9 +1,9 @@
/*
* entry.c
*
* $Revision: 1.19 $
* $Author: jfilby $
* $Date: 2002/08/19 22:01:11 $
* $Revision: 1.20 $
* $Author: dwelch $
* $Date: 2002/09/01 20:39:53 $
*
*/
@ -13,6 +13,7 @@
#define DBG_PREFIX "VGADDI: "
static BOOL VGAInitialized = FALSE;
DRVFN FuncList[] =
{
@ -186,12 +187,15 @@ DrvAssertMode(IN DHPDEV DPev,
return FALSE;
}
if (!InitVGA(ppdev, FALSE))
{
// Failed to initialize the VGA
return FALSE;
}
if (!VGAInitialized)
{
if (!InitVGA(ppdev, FALSE))
{
// Failed to initialize the VGA
return FALSE;
}
VGAInitialized = TRUE;
}
} else {
// Go back to last known mode
DPRINT( "ppdev: %x, KMDriver: %x", ppdev, ppdev->KMDriver );
@ -200,7 +204,7 @@ DrvAssertMode(IN DHPDEV DPev,
// Failed to go back to mode
return FALSE;
}
VGAInitialized = FALSE;
}
}
@ -323,10 +327,14 @@ DrvEnableSurface(IN DHPDEV PDev)
DPRINT1("DrvEnableSurface() called\n");
// Initialize the VGA
if (!InitVGA(ppdev, TRUE))
{
goto error_done;
}
if (!VGAInitialized)
{
if (!InitVGA(ppdev, TRUE))
{
goto error_done;
}
VGAInitialized = TRUE;
}
CHECKPOINT1;
// dhsurf is of type DEVSURF, which is the drivers specialized surface type

View file

@ -57,9 +57,19 @@ BOOL DIBtoVGA(
}
tMask += Mask->lDelta;
}
}
} else
} else if (rop4 == PATCOPY)
{
for (j=0;j<dy;j++)
{
for (i=0;i<dx;i++)
{
vgaPutPixel(DestRect->left+i, DestRect->top+j,
Brush->iSolidColor);
}
}
}
else
DIB_BltToVGA(DestRect->left, DestRect->top, dx, dy, Source->pvBits, Source->lDelta);
} else {

View file

@ -355,6 +355,7 @@ NtUserGetAsyncKeyState 1
NtUserGetCaretBlinkTime 0
NtUserGetCaretPos 1
NtUserGetClassInfo 5
NtUserGetClassLong 2
NtUserGetClassName 3
NtUserGetClipboardData 2
NtUserGetClipboardFormatName 3

View file

@ -1302,14 +1302,6 @@ extern "C" {
#define DCX_EXCLUDEUPDATE (0x00000100L)
#define DCX_INTERSECTUPDATE (0x00000200L)
/* Internal DCX flags */
#define DCX_DCEEMPTY (0x00000800L)
#define DCX_DCEBUSY (0x00001000L)
#define DCX_DCEDIRTY (0x00002000L)
#define DCX_WINDOWPAINT (0x00020000L)
#define DCX_KEEPCLIPRGN (0x00040000L)
#define DCX_NOCLIPCHILDREN (0x00080000L)
/* GetDeviceCaps */
#define DRIVERVERSION (0)
#define TECHNOLOGY (2)

View file

@ -614,8 +614,7 @@ STDCALL
NtUserGetCursorInfo(
DWORD Unknown0);
DWORD
STDCALL
HDC STDCALL
NtUserGetDC(HWND hWnd);
HDC STDCALL NtUserGetDCEx(HWND hWnd, HANDLE hRegion, ULONG Flags);

View file

@ -146,5 +146,8 @@ W32kGetRegionData(HRGN hrgn,
HRGN REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, PPOINT lpPt);
HRGN STDCALL
UnsafeW32kCreateRectRgnIndirect(CONST PRECT rc);
INT STDCALL
UnsafeW32kGetRgnBox(HRGN hRgn,
LPRECT pRect);
#endif

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.9 2002/08/31 23:18:45 dwelch Exp $
/* $Id: stubs.c,v 1.10 2002/09/01 20:39:54 dwelch Exp $
*
* reactos/lib/gdi32/misc/stubs.c
*
@ -690,15 +690,6 @@ GetRasterizerCaps(
HGDIOBJ
STDCALL
GetStockObject(
int a0
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
@ -939,20 +930,6 @@ OffsetClipRgn(
}
BOOL
STDCALL
PatBlt(
HDC a0,
int a1,
int a2,
int a3,
int a4,
DWORD a5
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}

View file

@ -217,6 +217,11 @@ SetPixel(HDC hDC,
return W32kSetPixel(hDC, X, Y, Color);
}
BOOL STDCALL
PatBlt(HDC hDC, INT Top, INT Left, INT Width, INT Height, ULONG Rop)
{
return(W32kPatBlt(hDC, Top, Left, Width, Height, Rop));
}

View file

@ -7,6 +7,13 @@
#include <ddk/ntddk.h>
#include <win32k/kapi.h>
HGDIOBJ STDCALL
GetStockObject(int Index)
{
return(W32kGetStockObject(Index));
}
int STDCALL
GetClipBox(HDC hDc, LPRECT Rect)
{

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.10 2002/08/31 23:18:46 dwelch Exp $
/* $Id: stubs.c,v 1.11 2002/09/01 20:39:55 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -223,14 +223,6 @@ GetSysColor(
return 0;
}
HBRUSH
STDCALL
GetSysColorBrush(
int nIndex)
{
return (HBRUSH)0;
}
HMENU
STDCALL
GetSystemMenu(

View file

@ -1,4 +1,4 @@
/* $Id: class.c,v 1.13 2002/06/18 21:51:09 dwelch Exp $
/* $Id: class.c,v 1.14 2002/09/01 20:39:55 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -53,22 +53,26 @@ GetClassInfoW(
return FALSE;
}
DWORD
STDCALL
GetClassLongA(
HWND hWnd,
int nIndex)
DWORD STDCALL
GetClassLongA(HWND hWnd, int nIndex)
{
return 0;
switch (nIndex)
{
case GCL_WNDPROC:
UNIMPLEMENTED;
return(0);
case GCL_MENUNAME:
UNIMPLEMENTED;
return(0);
default:
return(GetClassLongW(hWnd, nIndex));
}
}
DWORD
STDCALL
GetClassLongW(
HWND hWnd,
int nIndex)
DWORD STDCALL
GetClassLongW(HWND hWnd, int nIndex)
{
return 0;
return(NtUserGetClassLong(hWnd, nIndex));
}
int

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.5 2002/08/31 23:18:46 dwelch Exp $
/* $Id: defwnd.c,v 1.6 2002/09/01 20:39:55 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -69,6 +69,12 @@ GetSysColorPen(int nIndex)
return(CreatePen(PS_SOLID, 1, SysColours[nIndex]));
}
HBRUSH STDCALL
GetSysColorBrush(int nIndex)
{
return(CreateSolidBrush(SysColours[nIndex]));
}
LRESULT STDCALL
DefFrameProcA(HWND hWnd,

View file

@ -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: draw.c,v 1.1 2002/06/13 20:36:40 dwelch Exp $
/* $Id: draw.c,v 1.2 2002/09/01 20:39:55 dwelch Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/input.c
@ -32,6 +32,10 @@
#include <user32.h>
#include <debug.h>
/* GLOBALS *******************************************************************/
#define COLOR_MAX (28)
/* FUNCTIONS *****************************************************************/
WINBOOL
@ -127,15 +131,25 @@ FlashWindowEx(
{
return FALSE;
}
int
STDCALL
FillRect(
HDC hDC,
CONST RECT *lprc,
HBRUSH hbr)
int STDCALL
FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr)
{
return 0;
HBRUSH prevhbr;
/*if (hbr <= (HBRUSH)(COLOR_MAX + 1))
{
hbr = GetSysColorBrush((INT)hbr - 1);
}*/
if ((prevhbr = SelectObject(hDC, hbr)) == NULL)
{
return(FALSE);
}
PatBlt(hDC, lprc->left, lprc->top, lprc->right - lprc->left,
lprc->bottom - lprc->top, PATCOPY);
SelectObject(hDC, prevhbr);
return(TRUE);
}
WINBOOL
STDCALL
DrawAnimatedRects(

View file

@ -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: rect.c,v 1.5 2002/06/13 20:36:40 dwelch Exp $
/* $Id: rect.c,v 1.6 2002/09/01 20:39:55 dwelch Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/input.c
@ -34,30 +34,31 @@
/* FUNCTIONS *****************************************************************/
WINBOOL
STDCALL
CopyRect(
LPRECT lprcDst,
CONST RECT *lprcSrc)
WINBOOL STDCALL
CopyRect(LPRECT lprcDst, CONST RECT *lprcSrc)
{
return FALSE;
*lprcDst = *lprcSrc;
return(TRUE);
}
WINBOOL
STDCALL
EqualRect(
CONST RECT *lprc1,
CONST RECT *lprc2)
{
UNIMPLEMENTED;
return FALSE;
}
WINBOOL
STDCALL
InflateRect(
LPRECT lprc,
int dx,
int dy)
WINBOOL STDCALL
InflateRect(LPRECT rect, int dx, int dy)
{
return FALSE;
rect->left -= dx;
rect->top -= dy;
rect->right -= dx;
rect->bottom -= dy;
return(TRUE);
}
WINBOOL
@ -67,66 +68,85 @@ IntersectRect(
CONST RECT *lprcSrc1,
CONST RECT *lprcSrc2)
{
return FALSE;
}
WINBOOL
STDCALL
IsRectEmpty(
CONST RECT *lprc)
{
return FALSE;
}
WINBOOL
STDCALL
OffsetRect(
LPRECT lprc,
int dx,
int dy)
{
return FALSE;
}
WINBOOL
STDCALL
PtInRect(
CONST RECT *lprc,
POINT pt)
{
return FALSE;
}
WINBOOL
STDCALL
SetRect(
LPRECT lprc,
int xLeft,
int yTop,
int xRight,
int yBottom)
{
UNIMPLEMENTED;
return FALSE;
}
WINBOOL
STDCALL
SetRectEmpty(
LPRECT lprc)
WINBOOL STDCALL
IsRectEmpty(CONST RECT *lprc)
{
return((lprc->left >= lprc->right) || (lprc->top >= lprc->bottom));
}
WINBOOL STDCALL
OffsetRect(LPRECT rect, int dx, int dy)
{
rect->left += dx;
rect->top += dy;
rect->right += dx;
rect->bottom += dy;
return(TRUE);
}
WINBOOL STDCALL
PtInRect(CONST RECT *lprc, POINT pt)
{
return((pt.x >= lprc->left) && (pt.x < lprc->right) &&
(pt.y >= lprc->top) && (pt.y < lprc->bottom));
}
WINBOOL STDCALL
SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom)
{
lprc->left = xLeft;
lprc->top = yTop;
lprc->right = xRight;
lprc->bottom = yBottom;
return(TRUE);
}
BOOL STDCALL
SetRectEmpty(LPRECT lprc)
{
lprc->left = lprc->right = lprc->top = lprc->bottom = 0;
return(TRUE);
}
WINBOOL STDCALL
SubtractRect(LPRECT lprcDst, CONST RECT *lprcSrc1, CONST RECT *lprcSrc2)
{
UNIMPLEMENTED;
return FALSE;
}
WINBOOL
STDCALL
SubtractRect(
LPRECT lprcDst,
CONST RECT *lprcSrc1,
CONST RECT *lprcSrc2)
WINBOOL STDCALL
UnionRect(LPRECT lprcDst, CONST RECT *lprcSrc1, CONST RECT *lprcSrc2)
{
return FALSE;
}
WINBOOL
STDCALL
UnionRect(
LPRECT lprcDst,
CONST RECT *lprcSrc1,
CONST RECT *lprcSrc2)
{
return FALSE;
if (IsRectEmpty(lprcSrc1))
{
if (IsRectEmpty(lprcSrc2))
{
SetRectEmpty(lprcDst);
return(FALSE);
}
else
{
*lprcDst = *lprcSrc2;
}
}
else
{
if (IsRectEmpty(lprcSrc2))
{
*lprcDst = *lprcSrc1;
}
else
{
lprcDst->left = min(lprcSrc1->left, lprcSrc2->left);
lprcDst->top = min(lprcSrc1->top, lprcSrc2->top);
lprcDst->right = max(lprcSrc1->right, lprcSrc2->right);
lprcDst->bottom = max(lprcSrc1->bottom, lprcSrc2->bottom);
}
}
return(TRUE);
}

View file

@ -72,9 +72,12 @@ EngBitBlt(SURFOBJ *Dest,
if(Source != NULL) SourceGDI = (PSURFGDI)AccessInternalObjectFromUserObject(Source);
if(Dest != NULL) DestGDI = (PSURFGDI)AccessInternalObjectFromUserObject(Dest);
MouseSafetyOnDrawStart(Source, SourceGDI, SourcePoint->x, SourcePoint->y,
(SourcePoint->x + abs(DestRect->right - DestRect->left)),
(SourcePoint->y + abs(DestRect->bottom - DestRect->top)));
if (Source != NULL)
{
MouseSafetyOnDrawStart(Source, SourceGDI, SourcePoint->x, SourcePoint->y,
(SourcePoint->x + abs(DestRect->right - DestRect->left)),
(SourcePoint->y + abs(DestRect->bottom - DestRect->top)));
}
MouseSafetyOnDrawStart(Dest, DestGDI, DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
// If we don't have to do anything special, we can punt to DrvCopyBits

View file

@ -29,7 +29,7 @@ typedef struct tagDCE
HWND hwndDC;
HRGN hClipRgn;
DCE_TYPE type;
DWORD DCXflags;
DWORD DCXFlags;
} DCE, *PDCE;

View file

@ -74,7 +74,7 @@ typedef struct _WINDOW_OBJECT
/* Pointer to the parent window. */
struct _WINDOW_OBJECT* Parent;
/* DC Entries (DCE) */
PDCE dce;
PDCE Dce;
} WINDOW_OBJECT, *PWINDOW_OBJECT;
/* Window flags. */

View file

@ -1,4 +1,4 @@
/* $Id: class.c,v 1.10 2002/08/16 01:39:17 dwelch Exp $
/* $Id: class.c,v 1.11 2002/09/01 20:39:56 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -18,6 +18,7 @@
#include <include/winsta.h>
#include <include/object.h>
#include <include/guicheck.h>
#include <include/window.h>
//#define NDEBUG
#include <debug.h>
@ -267,6 +268,37 @@ NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
DWORD STDCALL
NtUserGetClassLong(HWND hWnd, DWORD Offset)
{
PWINDOW_OBJECT WindowObject;
LONG Ret;
WindowObject = W32kGetWindowObject(hWnd);
if (WindowObject == NULL)
{
return(0);
}
switch (Offset)
{
case GCL_STYLE:
Ret = WindowObject->Class->Class.style;
break;
case GCL_CBWNDEXTRA:
Ret = WindowObject->Class->Class.cbWndExtra;
break;
case GCL_CBCLSEXTRA:
Ret = WindowObject->Class->Class.cbClsExtra;
break;
case GCL_HMODULE:
Ret = WindowObject->Class->Class.hInstance;
break;
case GCL_HBRBACKGROUND:
Ret = WindowObject->Class->Class.hbrBackground;
break;
default:
Ret = 0;
break;
}
W32kReleaseWindowObject(WindowObject);
return(Ret);
}
DWORD STDCALL

View file

@ -1,4 +1,4 @@
/* $Id: metric.c,v 1.2 2002/08/31 23:18:47 dwelch Exp $
/* $Id: metric.c,v 1.3 2002/09/01 20:39:56 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -53,6 +53,8 @@ NtUserGetSystemMetrics(ULONG Index)
return(17);
case SM_CYHSCROLL:
return(17);
case SM_CYCAPTION:
return(20);
default:
return(0xFFFFFFFF);
}

View file

@ -1,4 +1,4 @@
/* $Id: windc.c,v 1.5 2002/08/27 23:29:40 dwelch Exp $
/* $Id: windc.c,v 1.6 2002/09/01 20:39:56 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -25,13 +25,26 @@
#define NDEBUG
#include <debug.h>
static PDCE firstDCE;
/* GLOBALS *******************************************************************/
static PDCE FirstDce = NULL;
#define DCX_CACHECOMPAREMASK (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | \
DCX_CACHE | DCX_WINDOW | DCX_PARENTCLIP)
/* FUNCTIONS *****************************************************************/
VOID DCE_FreeWindowDCE(HWND);
INT DCE_ExcludeRgn(HDC, HWND, HRGN);
BOOL DCE_InvalidateDCE(HWND, const PRECTL);
VOID STATIC
DceOffsetVisRgn(HDC hDC, HRGN hVisRgn)
{
DC *dc = DC_HandleToPtr(hDC);
if (dc == NULL)
{
return;
}
W32kOffsetRgn(hVisRgn, dc->w.DCOrgX, dc->w.DCOrgY);
DC_ReleasePtr(hDC);
}
BOOL STATIC
DceGetVisRect(PWINDOW_OBJECT Window, BOOL ClientArea, RECT* Rect)
@ -130,7 +143,7 @@ DceGetVisRgn(HWND hWnd, ULONG Flags, HWND hWndChild, ULONG CFlags)
if (Window != NULL && DceGetVisRect(Window, !(Flags & DCX_WINDOW), &Rect))
{
if ((VisRgn = W32kCreateRectRgnIndirect(&Rect)) != NULL)
if ((VisRgn = UnsafeW32kCreateRectRgnIndirect(&Rect)) != NULL)
{
HRGN ClipRgn = W32kCreateRectRgn(0, 0, 0, 0);
INT XOffset, YOffset;
@ -232,8 +245,7 @@ NtUserReleaseDC(HWND hWnd, HDC hDc)
}
DWORD
STDCALL
HDC STDCALL
NtUserGetDC(HWND hWnd)
{
if (!hWnd)
@ -241,159 +253,279 @@ NtUserGetDC(HWND hWnd)
return NtUserGetDCEx(hWnd, 0, DCX_USESTYLE);
}
DCE* DceAllocDCE(HWND hWnd, DCE_TYPE Type)
{
HDCE DceHandle;
DCE* Dce;
DceHandle = DCEOBJ_AllocDCE();
Dce = DCEOBJ_LockDCE(DceHandle);
Dce->hDC = W32kCreateDC(L"DISPLAY", NULL, NULL, NULL);
Dce->hwndCurrent = hWnd;
Dce->hClipRgn = NULL;
Dce->next = FirstDce;
FirstDce = Dce;
if (Type != DCE_CACHE_DC)
{
Dce->DCXFlags = DCX_DCEBUSY;
if (hWnd != NULL)
{
PWINDOW_OBJECT WindowObject;
WindowObject = W32kGetWindowObject(hWnd);
if (WindowObject->Style & WS_CLIPCHILDREN)
{
Dce->DCXFlags |= DCX_CLIPCHILDREN;
}
if (WindowObject->Style & WS_CLIPSIBLINGS)
{
Dce->DCXFlags |= DCX_CLIPSIBLINGS;
}
W32kReleaseWindowObject(WindowObject);
}
}
else
{
Dce->DCXFlags = DCX_CACHE | DCX_DCEEMPTY;
}
return(Dce);
}
VOID STATIC
DceSetDrawable(PWINDOW_OBJECT WindowObject, HDC hDC, ULONG Flags,
BOOL SetClipOrigin)
{
DC *dc = DC_HandleToPtr(hDC);
if (WindowObject == NULL)
{
dc->w.DCOrgX = 0;
dc->w.DCOrgY = 0;
}
else
{
if (Flags & DCX_WINDOW)
{
dc->w.DCOrgX = WindowObject->WindowRect.left;
dc->w.DCOrgY = WindowObject->WindowRect.top;
}
else
{
dc->w.DCOrgX = WindowObject->ClientRect.left;
dc->w.DCOrgY = WindowObject->ClientRect.top;
}
/* FIXME: Offset by parent's client rectangle. */
}
DC_ReleasePtr(hDC);
}
HDC STDCALL
NtUserGetDCEx(HWND hWnd, HANDLE hRegion, ULONG Flags)
{
HDC hdc = 0;
HDCE hdce;
PDCE dce;
DWORD dcxFlags = 0;
BOOL bUpdateVisRgn = TRUE;
BOOL bUpdateClipOrigin = FALSE;
HWND parent, full;
PWINDOW_OBJECT Window;
PWINDOW_OBJECT Window;
ULONG DcxFlags;
DCE* Dce;
BOOL UpdateVisRgn = TRUE;
BOOL UpdateClipOrigin = FALSE;
HANDLE hRgnVisible = NULL;
DPRINT("hWnd %04x, hRegion %04x, Flags %08x\n", hWnd, hRegion, (unsigned)Flags);
if (!hWnd) hWnd = W32kGetDesktopWindow();
if (!(Window = W32kGetWindowObject(hWnd))) return 0;
// fixup flags
if (Flags & (DCX_WINDOW | DCX_PARENTCLIP)) Flags |= DCX_CACHE;
if (Flags & DCX_USESTYLE)
if ((Window = W32kGetWindowObject(hWnd)) == NULL)
{
Flags &= ~(DCX_CLIPCHILDREN | DCX_CLIPSIBLINGS | DCX_PARENTCLIP);
return(0);
}
if(Window->Style & WS_CLIPSIBLINGS)
Flags |= DCX_CLIPSIBLINGS;
if (Window->Dce == NULL)
{
Flags |= DCX_CACHE;
}
if (!(Flags & DCX_WINDOW))
if (Flags & DCX_USESTYLE)
{
Flags &= ~(DCX_CLIPCHILDREN | DCX_CLIPSIBLINGS | DCX_PARENTCLIP);
if (Window->Style & WS_CLIPSIBLINGS)
{
if (Window->ExStyle & CS_PARENTDC) Flags |= DCX_PARENTCLIP;
Flags |= DCX_CLIPSIBLINGS;
}
if (Window->Style & WS_CLIPCHILDREN &&
!(Window->Style & WS_MINIMIZE)) Flags |= DCX_CLIPCHILDREN;
if (!Window->dce) Flags |= DCX_CACHE;
if (!(Flags & DCX_WINDOW))
{
if (Window->Class->Class.style & CS_PARENTDC)
{
Flags |= DCX_PARENTCLIP;
}
if (Window->Style & WS_CLIPCHILDREN &&
!(Window->Style & WS_MINIMIZE))
{
Flags |= DCX_CLIPCHILDREN;
}
}
else
{
Flags |= DCX_CACHE;
}
}
if (Flags & DCX_WINDOW) Flags &= ~DCX_CLIPCHILDREN;
parent = W32kGetParentWindow(hWnd);
if (!parent || (parent == W32kGetDesktopWindow()))
Flags = (Flags & ~DCX_PARENTCLIP) | DCX_CLIPSIBLINGS;
// it seems parent clip is ignored when clipping siblings or children
if (Flags & (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN)) Flags &= ~DCX_PARENTCLIP;
if(Flags & DCX_PARENTCLIP)
if (Flags & DCX_NOCLIPCHILDREN)
{
LONG parent_style = NtUserGetWindowLong(parent, GWL_STYLE);
if((Window->Style & WS_VISIBLE) && (parent_style & WS_VISIBLE))
{
Flags &= ~DCX_CLIPCHILDREN;
if (parent_style & WS_CLIPSIBLINGS) Flags |= DCX_CLIPSIBLINGS;
}
Flags |= DCX_CACHE;
Flags |= ~(DCX_PARENTCLIP | DCX_CLIPCHILDREN);
}
// find a suitable DCE
dcxFlags = Flags & (DCX_PARENTCLIP | DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN |
DCX_CACHE | DCX_WINDOW);
if (Flags & DCX_CACHE)
if (Flags & DCX_WINDOW)
{
PDCE dceEmpty;
PDCE dceUnused;
Flags = (Flags & ~DCX_CLIPCHILDREN) | DCX_CACHE;
}
dceEmpty = dceUnused = NULL;
/* Strategy: First, we attempt to find a non-empty but unused DCE with
* compatible flags. Next, we look for an empty entry. If the cache is
* full we have to purge one of the unused entries.
*/
for (dce = firstDCE; (dce); dce = dce->next)
if (!(Window->Style & WS_CHILD) || Window->Parent == NULL)
{
Flags &= ~DCX_PARENTCLIP;
}
else if (Flags & DCX_PARENTCLIP)
{
Flags |= DCX_CACHE;
if (!(Flags & (DCX_CLIPCHILDREN | DCX_CLIPSIBLINGS)))
{
if ((dce->DCXflags & (DCX_CACHE | DCX_DCEBUSY)) == DCX_CACHE)
if ((Window->Style & WS_VISIBLE) &&
(Window->Parent->Style & WS_VISIBLE))
{
dceUnused = dce;
if (dce->DCXflags & DCX_DCEEMPTY)
dceEmpty = dce;
else
if ((dce->hwndCurrent == hWnd) &&
((dce->DCXflags & (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN |
DCX_CACHE | DCX_WINDOW | DCX_PARENTCLIP)) == dcxFlags))
Flags &= ~DCX_CLIPCHILDREN;
if (Window->Parent->Style & WS_CLIPSIBLINGS)
{
DPRINT("Found valid %08x dce [%04x], flags %08x\n",
(unsigned)dce, hWnd, (unsigned)dcxFlags);
bUpdateVisRgn = FALSE;
bUpdateClipOrigin = TRUE;
break;
Flags |= DCX_CLIPSIBLINGS;
}
}
}
}
DcxFlags = Flags & DCX_CACHECOMPAREMASK;
if (Flags & DCX_CACHE)
{
DCE* DceEmpty = NULL;
DCE* DceUnused = NULL;
for (Dce = FirstDce; Dce != NULL; Dce = Dce->next)
{
if ((Dce->DCXFlags & (DCX_CACHE | DCX_DCEBUSY)) == DCX_CACHE)
{
DceUnused = Dce;
if (Dce->DCXFlags & DCX_DCEEMPTY)
{
DceEmpty = Dce;
}
else if (Dce->hwndCurrent == hWnd &&
((Dce->DCXFlags & DCX_CACHECOMPAREMASK) == DcxFlags))
{
UpdateVisRgn = FALSE;
UpdateClipOrigin = TRUE;
break;
}
}
}
if (!dce) dce = (dceEmpty) ? dceEmpty : dceUnused;
// if there's no dce empty or unused, allocate a new one
if (!dce)
{
hdce = DCEOBJ_AllocDCE();
if (hdce == NULL)
{
return 0;
}
dce = DCEOBJ_LockDCE(hdce);
dce->type = DCE_CACHE_DC;
dce->hDC = W32kCreateDC(L"DISPLAY", NULL, NULL, NULL);
}
}
else
{
dce = Window->dce;
if (dce && dce->hwndCurrent == hWnd)
if (Dce == NULL)
{
DPRINT("skipping hVisRgn update\n");
bUpdateVisRgn = FALSE; // updated automatically, via DCHook()
Dce = (DceEmpty == NULL) ? DceEmpty : DceUnused;
}
if (Dce == NULL)
{
Dce = DceAllocDCE(NULL, DCE_CACHE_DC);
}
}
if (!dce)
else
{
hdc = 0;
goto END;
Dce = Window->Dce;
/* FIXME: Implement this. */
DbgBreakPoint();
}
if (!(Flags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN))) hRegion = 0;
if (((Flags ^ dce->DCXflags) & (DCX_INTERSECTRGN | DCX_EXCLUDERGN)) &&
(dce->hClipRgn != hRegion))
if (Dce == NULL)
{
// if the extra clip region has changed, get rid of the old one
/* DCE_DeleteClipRgn(dce); */
W32kReleaseWindowObject(Window);
return(NULL);
}
dce->hwndCurrent = hWnd;
dce->hClipRgn = hRegion;
dce->DCXflags = Flags & (DCX_PARENTCLIP | DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN |
DCX_CACHE | DCX_WINDOW | DCX_WINDOWPAINT |
DCX_KEEPCLIPRGN | DCX_INTERSECTRGN | DCX_EXCLUDERGN);
dce->DCXflags |= DCX_DCEBUSY;
dce->DCXflags &= ~DCX_DCEDIRTY;
hdc = dce->hDC;
Dce->hwndCurrent = hWnd;
Dce->hClipRgn = NULL;
Dce->DCXFlags = DcxFlags | (Flags & DCX_WINDOWPAINT) | DCX_DCEBUSY;
/* if (bUpdateVisRgn) SetHookFlags(hdc, DCHF_INVALIDATEVISRGN); // force update */
DceSetDrawable(Window, Dce->hDC, Flags, UpdateClipOrigin);
/* if (!USER_Driver.pGetDC(hWnd, hdc, hRegion, Flags)) hdc = 0; */
if (UpdateVisRgn)
{
if (Flags & DCX_PARENTCLIP)
{
PWINDOW_OBJECT Parent;
DPRINT("(%04x,%04x,0x%lx): returning %04x\n", hWnd, hRegion, Flags, hdc);
Parent = Window->Parent;
END:
/* WIN_ReleasePtr(Window); */
return hdc;
if (Window->Style & WS_VISIBLE &&
!(Parent->Style & WS_MINIMIZE))
{
if (Parent->Style & WS_CLIPSIBLINGS)
{
DcxFlags = DCX_CLIPSIBLINGS |
(Flags & ~(DCX_CLIPCHILDREN | DCX_WINDOW));
}
else
{
DcxFlags = Flags &
~(DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DCX_WINDOW);
}
hRgnVisible = DceGetVisRgn(Parent->Self, DcxFlags,
Window->Self, Flags);
if (Flags & DCX_WINDOW)
{
W32kOffsetRgn(hRgnVisible, -Window->WindowRect.left,
-Window->WindowRect.top);
}
else
{
W32kOffsetRgn(hRgnVisible, -Window->ClientRect.left,
-Window->ClientRect.top);
}
DceOffsetVisRgn(Dce->hDC, hRgnVisible);
}
else
{
hRgnVisible = W32kCreateRectRgn(0, 0, 0, 0);
}
}
else
{
if (hWnd == W32kGetDesktopWindow())
{
hRgnVisible =
W32kCreateRectRgn(0, 0,
NtUserGetSystemMetrics(SM_CXSCREEN),
NtUserGetSystemMetrics(SM_CYSCREEN));
}
else
{
hRgnVisible = DceGetVisRgn(hWnd, Flags, 0, 0);
DceOffsetVisRgn(Dce->hDC, hRgnVisible);
}
Dce->DCXFlags &= ~DCX_DCEDIRTY;
W32kSelectVisRgn(Dce->hDC, hRgnVisible);
}
}
if (Flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN))
{
DPRINT1("FIXME.\n");
}
if (hRgnVisible != NULL)
{
W32kDeleteObject(hRgnVisible);
}
W32kReleaseWindowObject(Window);
return(Dce->hDC);
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.13 2002/08/31 23:18:47 dwelch Exp $
/* $Id: window.c,v 1.14 2002/09/01 20:39:56 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -158,9 +158,10 @@ W32kReleaseWindowObject(PWINDOW_OBJECT Window)
VOID
W32kGetClientRect(PWINDOW_OBJECT WindowObject, PRECT Rect)
{
Rect->left = Rect->bottom = 0;
Rect->left = Rect->top = 0;
Rect->right = WindowObject->ClientRect.right - WindowObject->ClientRect.left;
Rect->top = WindowObject->ClientRect.bottom - WindowObject->ClientRect.top;
Rect->bottom =
WindowObject->ClientRect.bottom - WindowObject->ClientRect.top;
}
BOOL STDCALL

View file

@ -1,4 +1,4 @@
/* $Id: brush.c,v 1.14 2002/07/13 21:37:26 ei Exp $
/* $Id: brush.c,v 1.15 2002/09/01 20:39:56 dwelch Exp $
*/
@ -8,6 +8,7 @@
#include <win32k/bitmaps.h>
#include <win32k/brush.h>
//#include <win32k/debug.h>
#include <include/object.h>
#define NDEBUG
#include <win32k/debug1.h>
@ -177,13 +178,63 @@ BOOL STDCALL W32kFixBrushOrgEx(VOID)
}
BOOL STDCALL W32kPatBlt(HDC hDC,
INT XLeft,
INT YLeft,
INT Width,
INT Height,
DWORD ROP)
INT XLeft,
INT YLeft,
INT Width,
INT Height,
DWORD ROP)
{
UNIMPLEMENTED;
RECT DestRect;
PBRUSHOBJ BrushObj;
PSURFOBJ SurfObj;
DC *dc = DC_HandleToPtr(hDC);
BOOL ret;
if (dc == NULL)
{
return(FALSE);
}
SurfObj = (SURFOBJ*)AccessUserObject((ULONG)dc->Surface);
BrushObj = (BRUSHOBJ*) GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
assert(BrushObj);
if (BrushObj->logbrush.lbStyle != BS_NULL)
{
if (Width > 0)
{
DestRect.left = XLeft + dc->w.DCOrgX;
DestRect.right = XLeft + Width + dc->w.DCOrgX;
}
else
{
DestRect.left = XLeft + Width + dc->w.DCOrgX;
DestRect.right = XLeft + dc->w.DCOrgX;
}
if (Height > 0)
{
DestRect.top = YLeft + dc->w.DCOrgY;
DestRect.bottom = YLeft + Height + dc->w.DCOrgY;
}
else
{
DestRect.top = YLeft + Height + dc->w.DCOrgY;
DestRect.bottom = YLeft + dc->w.DCOrgY;
}
ret = EngBitBlt(SurfObj,
NULL,
NULL,
NULL,
NULL,
&DestRect,
NULL,
NULL,
BrushObj,
NULL,
PATCOPY);
}
GDIOBJ_UnlockObj( dc->w.hBrush, GO_PEN_MAGIC );
return(ret);
}
BOOL STDCALL W32kSetBrushOrgEx(HDC hDC,

View file

@ -11,6 +11,25 @@
// #define NDEBUG
#include <win32k/debug1.h>
VOID
CLIPPING_UpdateGCRegion(DC* Dc)
{
if (Dc->w.hGCClipRgn == NULL)
{
Dc->w.hGCClipRgn = W32kCreateRectRgn(0, 0, 0, 0);
}
if (Dc->w.hClipRgn == NULL)
{
W32kCombineRgn(Dc->w.hGCClipRgn, Dc->w.hVisRgn, 0, RGN_COPY);
}
else
{
W32kCombineRgn(Dc->w.hGCClipRgn, Dc->w.hClipRgn, Dc->w.hVisRgn,
RGN_AND);
}
}
HRGN WINAPI SaveVisRgn(HDC hdc)
{
HRGN copy;
@ -35,7 +54,8 @@ HRGN WINAPI SaveVisRgn(HDC hdc)
return copy;
}
INT WINAPI SelectVisRgn(HDC hdc, HRGN hrgn)
INT WINAPI
W32kSelectVisRgn(HDC hdc, HRGN hrgn)
{
int retval;
DC *dc;
@ -46,7 +66,7 @@ INT WINAPI SelectVisRgn(HDC hdc, HRGN hrgn)
dc->w.flags &= ~DC_DIRTY;
retval = W32kCombineRgn(dc->w.hVisRgn, hrgn, 0, RGN_COPY);
//ei CLIPPING_UpdateGCRegion(dc);
CLIPPING_UpdateGCRegion(dc);
return retval;
}
@ -74,7 +94,7 @@ int STDCALL W32kGetClipBox(HDC hDC,
DC *dc;
if (!(dc = DC_HandleToPtr(hDC))) return ERROR;
retval = W32kGetRgnBox(dc->w.hGCClipRgn, rc);
retval = UnsafeW32kGetRgnBox(dc->w.hGCClipRgn, rc);
rc->left -= dc->w.DCOrgX;
rc->right -= dc->w.DCOrgX;
rc->top -= dc->w.DCOrgY;

View file

@ -1,4 +1,4 @@
/* $Id: dc.c,v 1.35 2002/08/19 21:49:45 ei Exp $
/* $Id: dc.c,v 1.36 2002/09/01 20:39:56 dwelch Exp $
*
* DC.C - Device context functions
*
@ -307,7 +307,8 @@ HDC STDCALL W32kCreateDC(LPCWSTR Driver,
/* Initialize the DC state */
DC_InitDC(hNewDC);
W32kSetTextColor(hNewDC, RGB(0xff, 0xff, 0xff));
NewDC->w.hVisRgn = W32kCreateRectRgn(0, 0, 640, 480);
W32kSetTextColor(hNewDC, RGB(0, 0, 0));
W32kSetTextAlign(hNewDC, TA_BASELINE);
DC_ReleasePtr( hNewDC );
return hNewDC;
@ -940,7 +941,8 @@ HGDIOBJ STDCALL W32kSelectObject(HDC hDC, HGDIOBJ hGDIObj)
if( PalGDI ){
XlateObj = (PXLATEOBJ)EngCreateXlate(PalGDI->Mode, PAL_RGB, dc->w.hPalette, NULL);
brush = GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
brush->iSolidColor = XLATEOBJ_iXlate(XlateObj, brush->iSolidColor);
brush->iSolidColor = XLATEOBJ_iXlate(XlateObj,
brush->logbrush.lbColor);
GDIOBJ_UnlockObj( dc->w.hBrush, GO_BRUSH_MAGIC);
}
break;
@ -1150,6 +1152,16 @@ HDC DC_AllocDC(LPCWSTR Driver)
wcscpy(NewDC->DriverName, Driver);
}
NewDC->w.xformWorld2Wnd.eM11 = 1.0f;
NewDC->w.xformWorld2Wnd.eM12 = 0.0f;
NewDC->w.xformWorld2Wnd.eM21 = 0.0f;
NewDC->w.xformWorld2Wnd.eM22 = 1.0f;
NewDC->w.xformWorld2Wnd.eDx = 0.0f;
NewDC->w.xformWorld2Wnd.eDy = 0.0f;
NewDC->w.xformWorld2Vport = NewDC->w.xformWorld2Wnd;
NewDC->w.xformVport2World = NewDC->w.xformWorld2Wnd;
NewDC->w.vport2WorldValid = TRUE;
GDIOBJ_UnlockObj( hDC, GO_DC_MAGIC );
return hDC;
}

View file

@ -5,6 +5,7 @@
#include <win32k/fillshap.h>
#include <win32k/dc.h>
#include <win32k/pen.h>
#include <include/object.h>
// #define NDEBUG
#include <win32k/debug1.h>
@ -78,11 +79,12 @@ W32kRectangle(HDC hDC,
int BottomRect)
{
DC *dc = DC_HandleToPtr(hDC);
SURFOBJ *SurfObj = (SURFOBJ*)AccessUserObject(dc->Surface);
SURFOBJ *SurfObj = (SURFOBJ*)AccessUserObject((ULONG)dc->Surface);
PBRUSHOBJ BrushObj;
BOOL ret;
PRECTL RectBounds;
PENOBJ * pen;
RECTL DestRect;
if(!dc)
return FALSE;
@ -94,10 +96,15 @@ W32kRectangle(HDC hDC,
ret = PATH_Rectangle(hDC, LeftRect, TopRect, RightRect, BottomRect);
} else {
// Draw the rectangle with the current pen
pen = (PENOBJ*) GDIOBJ_LockObj(dc->w.hPen, GO_PEN_MAGIC);
ASSERT(pen);
BrushObj = (PBRUSHOBJ)PenToBrushObj(dc, pen);
GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC );
pen = (PENOBJ*) GDIOBJ_LockObj(dc->w.hPen, GO_PEN_MAGIC);
ASSERT(pen);
BrushObj = (PBRUSHOBJ)PenToBrushObj(dc, pen);
GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC );
LeftRect += dc->w.DCOrgX;
RightRect += dc->w.DCOrgX;
TopRect += dc->w.DCOrgY;
BottomRect += dc->w.DCOrgY;
ret = EngLineTo(SurfObj,
NULL, // ClipObj,
@ -127,7 +134,27 @@ W32kRectangle(HDC hDC,
RectBounds, // Bounding rectangle
dc->w.ROPmode); // MIX */
ExFreePool(BrushObj);
BrushObj = (BRUSHOBJ*) GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
assert(BrushObj);
if (BrushObj->logbrush.lbStyle != BS_NULL)
{
DestRect.left = LeftRect + 1;
DestRect.right = RightRect - 1;
DestRect.top = TopRect + 1;
DestRect.bottom = BottomRect - 1;
ret = EngBitBlt(SurfObj,
NULL,
NULL,
NULL,
NULL,
&DestRect,
NULL,
NULL,
BrushObj,
NULL,
PATCOPY);
}
GDIOBJ_UnlockObj( dc->w.hBrush, GO_PEN_MAGIC );
}
// FIXME: Move current position in DC?

View file

@ -1,7 +1,7 @@
/*
* GDIOBJ.C - GDI object manipulation routines
*
* $Id: gdiobj.c,v 1.15 2002/08/04 18:21:59 ei Exp $
* $Id: gdiobj.c,v 1.16 2002/09/01 20:39:56 dwelch Exp $
*
*/
@ -252,7 +252,8 @@ PGDIOBJ GDIOBJ_LockObj( HGDIOBJ hObj, WORD Magic )
DPRINT("GDIOBJ_LockObj: hObj: %d, magic: %x, \n handleEntry: %x, mag %x\n", hObj, Magic, handleEntry, handleEntry->wMagic);
if (handleEntry == 0 || (handleEntry->wMagic != Magic && handleEntry->wMagic != GO_MAGIC_DONTCARE )
|| handleEntry->hProcessId != PsGetCurrentProcessId () )
|| (handleEntry->hProcessId != (HANDLE)0xFFFFFFFF &&
handleEntry->hProcessId != PsGetCurrentProcessId ()))
return NULL;
objectHeader = (PGDIOBJHDR) handleEntry->pObject;
@ -273,7 +274,8 @@ BOOL GDIOBJ_UnlockObj( HGDIOBJ hObj, WORD Magic )
DPRINT("GDIOBJ_UnlockObj: hObj: %d, magic: %x, \n handleEntry: %x\n", hObj, Magic, handleEntry);
if (handleEntry == 0 || (handleEntry->wMagic != Magic && handleEntry->wMagic != GO_MAGIC_DONTCARE )
|| handleEntry->hProcessId != PsGetCurrentProcessId ())
|| (handleEntry->hProcessId != (HANDLE)0xFFFFFFFF &&
handleEntry->hProcessId != PsGetCurrentProcessId ()))
return FALSE;
objectHeader = (PGDIOBJHDR) handleEntry->pObject;
@ -375,6 +377,20 @@ PGDIOBJ GDIOBJ_HandleToPtr (HGDIOBJ ObjectHandle, WORD Magic)
}
*/
VOID GDIOBJ_MarkObjectGlobal(HGDIOBJ ObjectHandle)
{
PGDI_HANDLE_ENTRY handleEntry;
if (ObjectHandle == NULL)
return;
handleEntry = GDIOBJ_iGetHandleEntryForIndex ((WORD)ObjectHandle & 0xffff);
if (handleEntry == 0)
return;
handleEntry->hProcessId = (HANDLE)0xFFFFFFFF;
}
WORD GDIOBJ_GetHandleMagic (HGDIOBJ ObjectHandle)
{
PGDI_HANDLE_ENTRY handleEntry;
@ -384,7 +400,8 @@ WORD GDIOBJ_GetHandleMagic (HGDIOBJ ObjectHandle)
handleEntry = GDIOBJ_iGetHandleEntryForIndex ((WORD)ObjectHandle & 0xffff);
if (handleEntry == 0 ||
handleEntry->hProcessId != PsGetCurrentProcessId ())
(handleEntry->hProcessId != (HANDLE)0xFFFFFFFF &&
handleEntry->hProcessId != PsGetCurrentProcessId ()))
return 0;
return handleEntry->wMagic;
@ -409,22 +426,38 @@ VOID CreateStockObjects(void)
// Create GDI Stock Objects from the logical structures we've defined
StockObjects[WHITE_BRUSH] = W32kCreateBrushIndirect(&WhiteBrush);
GDIOBJ_MarkObjectGlobal(StockObjects[WHITE_BRUSH]);
StockObjects[LTGRAY_BRUSH] = W32kCreateBrushIndirect(&LtGrayBrush);
GDIOBJ_MarkObjectGlobal(StockObjects[LTGRAY_BRUSH]);
StockObjects[GRAY_BRUSH] = W32kCreateBrushIndirect(&GrayBrush);
GDIOBJ_MarkObjectGlobal(StockObjects[GRAY_BRUSH]);
StockObjects[DKGRAY_BRUSH] = W32kCreateBrushIndirect(&DkGrayBrush);
GDIOBJ_MarkObjectGlobal(StockObjects[DKGRAY_BRUSH]);
StockObjects[BLACK_BRUSH] = W32kCreateBrushIndirect(&BlackBrush);
GDIOBJ_MarkObjectGlobal(StockObjects[BLACK_BRUSH]);
StockObjects[NULL_BRUSH] = W32kCreateBrushIndirect(&NullBrush);
GDIOBJ_MarkObjectGlobal(StockObjects[NULL_BRUSH]);
StockObjects[WHITE_PEN] = W32kCreatePenIndirect(&WhitePen);
GDIOBJ_MarkObjectGlobal(StockObjects[WHITE_PEN]);
StockObjects[BLACK_PEN] = W32kCreatePenIndirect(&BlackPen);
GDIOBJ_MarkObjectGlobal(StockObjects[BLACK_PEN]);
StockObjects[NULL_PEN] = W32kCreatePenIndirect(&NullPen);
GDIOBJ_MarkObjectGlobal(StockObjects[NULL_PEN]);
StockObjects[OEM_FIXED_FONT] = W32kCreateFontIndirect(&OEMFixedFont);
GDIOBJ_MarkObjectGlobal(StockObjects[OEM_FIXED_FONT]);
StockObjects[ANSI_FIXED_FONT] = W32kCreateFontIndirect(&AnsiFixedFont);
GDIOBJ_MarkObjectGlobal(StockObjects[ANSI_FIXED_FONT]);
StockObjects[SYSTEM_FONT] = W32kCreateFontIndirect(&SystemFont);
StockObjects[DEVICE_DEFAULT_FONT] = W32kCreateFontIndirect(&DeviceDefaultFont);
GDIOBJ_MarkObjectGlobal(StockObjects[SYSTEM_FONT]);
StockObjects[DEVICE_DEFAULT_FONT] =
W32kCreateFontIndirect(&DeviceDefaultFont);
GDIOBJ_MarkObjectGlobal(StockObjects[DEVICE_DEFAULT_FONT]);
StockObjects[SYSTEM_FIXED_FONT] = W32kCreateFontIndirect(&SystemFixedFont);
GDIOBJ_MarkObjectGlobal(StockObjects[SYSTEM_FIXED_FONT]);
StockObjects[DEFAULT_GUI_FONT] = W32kCreateFontIndirect(&DefaultGuiFont);
GDIOBJ_MarkObjectGlobal(StockObjects[DEFAULT_GUI_FONT]);
StockObjects[DEFAULT_PALETTE] = (HGDIOBJ*)PALETTE_Init();
}

View file

@ -88,6 +88,6 @@ W32kIntersectRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
Dest->left = max(Src1->left, Src2->left);
Dest->right = min(Src1->right, Src2->right);
Dest->top = max(Src1->top, Src2->top);
Dest->bottom = min(Src1->right, Src2->right);
Dest->bottom = min(Src1->bottom, Src2->bottom);
return(TRUE);
}

View file

@ -1682,29 +1682,47 @@ W32kFrameRgn(HDC hDC,
UNIMPLEMENTED;
}
INT
STDCALL
W32kGetRgnBox(HRGN hRgn,
LPRECT pRect)
INT STDCALL
UnsafeW32kGetRgnBox(HRGN hRgn,
LPRECT pRect)
{
PROSRGNDATA rgn = RGNDATA_LockRgn(hRgn);
DWORD ret;
if( rgn ){
RECT SafeRect;
SafeRect.left = rgn->rdh.rcBound.left;
SafeRect.top = rgn->rdh.rcBound.top;
SafeRect.right = rgn->rdh.rcBound.right;
SafeRect.bottom = rgn->rdh.rcBound.bottom;
ret = rgn->rdh.iType;
RGNDATA_UnlockRgn( hRgn );
if (rgn)
{
*pRect = rgn->rdh.rcBound;
ret = rgn->rdh.iType;
RGNDATA_UnlockRgn( hRgn );
return ret;
}
return 0; //if invalid region return zero
}
if(!NT_SUCCESS(MmCopyToCaller(pRect, &SafeRect, sizeof(RECT))))
return 0;
return ret;
}
INT STDCALL
W32kGetRgnBox(HRGN hRgn,
LPRECT pRect)
{
PROSRGNDATA rgn = RGNDATA_LockRgn(hRgn);
DWORD ret;
if (rgn)
{
RECT SafeRect;
SafeRect.left = rgn->rdh.rcBound.left;
SafeRect.top = rgn->rdh.rcBound.top;
SafeRect.right = rgn->rdh.rcBound.right;
SafeRect.bottom = rgn->rdh.rcBound.bottom;
ret = rgn->rdh.iType;
RGNDATA_UnlockRgn( hRgn );
if(!NT_SUCCESS(MmCopyToCaller(pRect, &SafeRect, sizeof(RECT))))
return 0;
return ret;
}
return 0; //if invalid region return zero
}

View file

@ -580,7 +580,7 @@ W32kTextOut(HDC hDC,
int error, glyph_index, n, load_flags = FT_LOAD_RENDER, i, j, sx, sy, scc;
FT_Face face;
FT_GlyphSlot glyph;
ULONG TextLeft = XStart, TextTop = YStart, SpaceBetweenChars = 2, pitch, previous;
ULONG TextLeft, TextTop, SpaceBetweenChars = 2, pitch, previous;
FT_Bool use_kerning;
RECTL DestRect, MaskRect;
POINTL SourcePoint, BrushOrigin;
@ -601,6 +601,11 @@ W32kTextOut(HDC hDC,
if( !dc )
return FALSE;
XStart += dc->w.DCOrgX;
YStart += dc->w.DCOrgY;
TextLeft = XStart;
TextTop = YStart;
TextObj = TEXTOBJ_LockText(dc->w.hFont);
for(i=0; i<FontsLoaded; i++)