some fixes on on gdi handles

svn path=/trunk/; revision=6120
This commit is contained in:
Thomas Bluemel 2003-09-24 16:01:32 +00:00
parent 3ed28b6e6f
commit 3fd1dcd5e0
4 changed files with 42 additions and 21 deletions

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: windc.c,v 1.23 2003/09/09 09:39:21 gvg Exp $
/* $Id: windc.c,v 1.24 2003/09/24 16:01:32 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -132,6 +132,9 @@ PDCE FASTCALL DceAllocDCE(HWND hWnd, DCE_TYPE Type)
DCE* Dce;
DceHandle = DCEOBJ_AllocDCE();
if(!DceHandle)
return NULL;
Dce = DCEOBJ_LockDCE(DceHandle);
Dce->hDC = NtGdiCreateDC(L"DISPLAY", NULL, NULL, NULL);
Dce->hwndCurrent = hWnd;
@ -171,6 +174,9 @@ DceSetDrawable(PWINDOW_OBJECT WindowObject, HDC hDC, ULONG Flags,
BOOL SetClipOrigin)
{
DC *dc = DC_LockDc(hDC);
if(!dc)
return;
if (WindowObject == NULL)
{
dc->w.DCOrgX = 0;
@ -342,8 +348,9 @@ NtUserGetDCEx(HWND hWnd, HANDLE ClipRegion, ULONG Flags)
DbgBreakPoint();
}
if (NULL == Dce && NULL != Window)
if (NULL == Dce)
{
if(NULL != Window)
IntReleaseWindowObject(Window);
return(NULL);
}
@ -366,6 +373,7 @@ NtUserGetDCEx(HWND hWnd, HANDLE ClipRegion, ULONG Flags)
if (NULL != ClipRegion)
{
Dce->hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
if(Dce->hClipRgn)
NtGdiCombineRgn(Dce->hClipRgn, ClipRegion, NULL, RGN_COPY);
NtGdiDeleteObject(ClipRegion);
}

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: cliprgn.c,v 1.24 2003/09/09 09:39:21 gvg Exp $ */
/* $Id: cliprgn.c,v 1.25 2003/09/24 16:01:32 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
@ -58,7 +58,10 @@ CLIPPING_UpdateGCRegion(DC* Dc)
#endif
Combined = NtGdiCreateRectRgn(0, 0, 0, 0);
ASSERT(NULL != Combined);
if(!Combined)
{
return;
}
if (Dc->w.hClipRgn == NULL)
{

View file

@ -19,7 +19,7 @@
/*
* GDIOBJ.C - GDI object manipulation routines
*
* $Id: gdiobj.c,v 1.42 2003/09/23 18:04:42 gvg Exp $
* $Id: gdiobj.c,v 1.43 2003/09/24 16:01:32 weiden Exp $
*
*/
@ -223,8 +223,16 @@ HGDIOBJ FASTCALL
GDIOBJ_AllocObj(WORD Size, DWORD ObjectType, GDICLEANUPPROC CleanupProc)
{
PGDIOBJHDR newObject;
WORD Index;
DPRINT("GDIOBJ_AllocObj: size: %d, type: 0x%08x\n", Size, ObjectType);
Index = GDIOBJ_iGetNextOpenHandleIndex ();
if (0 == Index)
{
DPRINT1("Out of GDI handles\n");
return NULL;
}
DPRINT("GDIOBJ_AllocObj: handle: %d, size: %d, type: 0x%08x\n", Index, Size, ObjectType);
newObject = ExAllocatePool(PagedPool, Size + sizeof (GDIOBJHDR));
if (newObject == NULL)
{
@ -233,14 +241,7 @@ GDIOBJ_AllocObj(WORD Size, DWORD ObjectType, GDICLEANUPPROC CleanupProc)
}
RtlZeroMemory (newObject, Size + sizeof(GDIOBJHDR));
newObject->wTableIndex = GDIOBJ_iGetNextOpenHandleIndex ();
DPRINT("GDIOBJ_AllocObj: object handle %d\n", newObject->wTableIndex );
if (0 == newObject->wTableIndex)
{
DPRINT1("Out of GDI handles\n");
ExFreePool(newObject);
return NULL;
}
newObject->wTableIndex = Index;
newObject->dwCount = 0;
newObject->hProcessId = PsGetCurrentProcessId ();
@ -248,9 +249,9 @@ GDIOBJ_AllocObj(WORD Size, DWORD ObjectType, GDICLEANUPPROC CleanupProc)
newObject->Magic = GDI_TYPE_TO_MAGIC(ObjectType);
newObject->lockfile = NULL;
newObject->lockline = 0;
HandleTable->Handles[newObject->wTableIndex] = newObject;
HandleTable->Handles[Index] = newObject;
return GDI_HANDLE_CREATE(newObject->wTableIndex, ObjectType);
return GDI_HANDLE_CREATE(Index, ObjectType);
}
/*!

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: text.c,v 1.51 2003/09/10 23:16:13 gvg Exp $ */
/* $Id: text.c,v 1.52 2003/09/24 16:01:32 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN
@ -1032,7 +1032,7 @@ NtGdiTextOut(HDC hDC,
{
// Fixme: Call EngTextOut, which does the real work (calling DrvTextOut where appropriate)
DC *dc = DC_LockDc(hDC);
DC *dc;
SURFOBJ *SurfObj;
int error, glyph_index, n, i;
FT_Face face;
@ -1057,6 +1057,7 @@ NtGdiTextOut(HDC hDC,
PXLATEOBJ XlateObj;
ULONG Mode;
dc = DC_LockDc(hDC);
if( !dc )
return FALSE;
SurfObj = (SURFOBJ*)AccessUserObject((ULONG) dc->Surface);
@ -1116,8 +1117,16 @@ NtGdiTextOut(HDC hDC,
if (OPAQUE == dc->w.backgroundMode)
{
hBrushBg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, dc->w.backgroundColor));
if(hBrushBg)
{
BrushBg = BRUSHOBJ_LockBrush(hBrushBg);
}
else
{
EngDeleteXlate(XlateObj);
goto fail;
}
}
EngDeleteXlate(XlateObj);
SourcePoint.x = 0;