Author: tkreuzer
Date: Sat Oct 6 08:33:17 2012
New Revision: 57492
URL:
http://svn.reactos.org/svn/reactos?rev=57492&view=rev
Log:
[GDI32]
- Use GdiAllocBatchCommand in DeleteObject instead of doing all manually
Modified:
trunk/reactos/win32ss/gdi/gdi32/include/gdi32p.h
trunk/reactos/win32ss/gdi/gdi32/objects/dc.c
Modified: trunk/reactos/win32ss/gdi/gdi32/include/gdi32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/include/…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/include/gdi32p.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/include/gdi32p.h [iso-8859-1] Sat Oct 6 08:33:17
2012
@@ -334,7 +334,7 @@
/* Check if the buffer is full */
if ((pTeb->GdiBatchCount >= GDI_BatchLimit) ||
- ((pTeb->GdiTebBatch.Offset + cjSize) > GDIBATCHBUFSIZE))
+ ((pTeb->GdiTebBatch.Offset + cjSize) > GDIBATCHBUFSIZE))
{
/* Call win32k, the kernel will call NtGdiFlushUserBatch to flush
the current batch */
Modified: trunk/reactos/win32ss/gdi/gdi32/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/objects/dc.c [iso-8859-1] Sat Oct 6 08:33:17 2012
@@ -320,27 +320,28 @@
WINAPI
DeleteObject(HGDIOBJ hObject)
{
- UINT Type = 0;
+ DWORD dwType = 0;
/* From Wine: DeleteObject does not SetLastError() on a null object */
if(!hObject) return FALSE;
- if (0 != ((DWORD) hObject & GDI_HANDLE_STOCK_MASK))
+ if ((DWORD)hObject & GDI_HANDLE_STOCK_MASK)
{
// Relax! This is a normal return!
DPRINT("Trying to delete system object 0x%x\n", hObject);
return TRUE;
}
+
// If you dont own it?! Get OUT!
if(!GdiIsHandleValid(hObject)) return FALSE;
- Type = GDI_HANDLE_GET_TYPE(hObject);
-
- if ((Type == GDI_OBJECT_TYPE_METAFILE) ||
- (Type == GDI_OBJECT_TYPE_ENHMETAFILE))
+ dwType = GDI_HANDLE_GET_TYPE(hObject);
+
+ if ((dwType == GDI_OBJECT_TYPE_METAFILE) ||
+ (dwType == GDI_OBJECT_TYPE_ENHMETAFILE))
return FALSE;
- switch (Type)
+ switch (dwType)
{
case GDI_OBJECT_TYPE_DC:
return DeleteDC((HDC) hObject);
@@ -367,33 +368,30 @@
{
PBRUSH_ATTR Brh_Attr;
PTEB pTeb;
-
- if ((!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &Brh_Attr)) ||
- (Brh_Attr == NULL) ) break;
+ PGDIBSOBJECT pgO;
+
+ if ((!GdiGetHandleUserData(hObject, dwType, (PVOID) &Brh_Attr)) ||
+ (Brh_Attr == NULL)) break;
pTeb = NtCurrentTeb();
if (pTeb->Win32ThreadInfo == NULL) break;
- if ((pTeb->GdiTebBatch.Offset + sizeof(GDIBSOBJECT)) <= GDIBATCHBUFSIZE)
- {
- PGDIBSOBJECT pgO = (PGDIBSOBJECT)(&pTeb->GdiTebBatch.Buffer[0] +
- pTeb->GdiTebBatch.Offset);
- pgO->gbHdr.Cmd = GdiBCDelObj;
- pgO->gbHdr.Size = sizeof(GDIBSOBJECT);
+ pgO = GdiAllocBatchCommand(NULL, GdiBCDelObj);
+ if (pgO)
+ {
pgO->hgdiobj = hObject;
-
- pTeb->GdiTebBatch.Offset += sizeof(GDIBSOBJECT);
- pTeb->GdiBatchCount++;
- if (pTeb->GdiBatchCount >= GDI_BatchLimit) NtGdiFlush();
return TRUE;
}
+
break;
}
+
case GDI_OBJECT_TYPE_BITMAP:
default:
break;
}
+
return NtGdiDeleteObjectApp(hObject);
}