Author: jimtabor
Date: Mon Nov 5 04:50:59 2007
New Revision: 30144
URL:
http://svn.reactos.org/svn/reactos?rev=30144&view=rev
Log:
- Implement batching for DeleteObject.
- Implemented DeleteRegion, a support function with batching.
- Add delete objects and a hack to fake the running of the batch to gdibatch.c.
- These batching functions will not run until proper structure attributes are
implemented.
Modified:
trunk/reactos/dll/win32/gdi32/include/gdi32p.h
trunk/reactos/dll/win32/gdi32/objects/dc.c
trunk/reactos/dll/win32/gdi32/objects/region.c
trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c
Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/include/gd…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/include/gdi32p.h (original)
+++ trunk/reactos/dll/win32/gdi32/include/gdi32p.h Mon Nov 5 04:50:59 2007
@@ -113,6 +113,10 @@
);
BOOL
+FASTCALL
+DeleteRegion( HRGN );
+
+BOOL
GdiIsHandleValid(HGDIOBJ hGdiObj);
BOOL
Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/dc…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/dc.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/dc.c Mon Nov 5 04:50:59 2007
@@ -284,7 +284,7 @@
DeleteObject(HGDIOBJ hObject)
{
UINT Type = 0;
-
+
/* From Wine: DeleteObject does not SetLastError() on a null object */
if(!hObject) return FALSE;
@@ -308,6 +308,8 @@
return DeleteDC((HDC) hObject);
case GDI_OBJECT_TYPE_COLORSPACE:
return NtGdiDeleteColorSpace((HCOLORSPACE) hObject);
+ case GDI_OBJECT_TYPE_REGION:
+ return DeleteRegion((HRGN) hObject);
#if 0
case GDI_OBJECT_TYPE_METADC:
return MFDRV_DeleteObject( hObject );
@@ -318,12 +320,42 @@
return EMFDRV_DeleteObject( hObject );
}
#endif
- case GDI_OBJECT_TYPE_REGION:
+ case GDI_OBJECT_TYPE_FONT:
+ break;
+
case GDI_OBJECT_TYPE_BRUSH:
case GDI_OBJECT_TYPE_EXTPEN:
case GDI_OBJECT_TYPE_PEN:
- case GDI_OBJECT_TYPE_FONT:
+ {
+#if 0
+ PBRUSH_ATTR Brh_Attr;
+ PTEB pTeb;
+
+ if ((!GdiGetHandleUserData(hObject, (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->hgdiobj = hObject;
+
+ pTeb->GdiTebBatch.Offset += sizeof(GDIBSSETBRHORG);
+ pTeb->GdiBatchCount++;
+ if (pTeb->GdiBatchCount >= GDI_BatchLimit) NtGdiFlush();
+ return TRUE;
+ }
+#endif
+ break;
+ }
case GDI_OBJECT_TYPE_BITMAP:
+ default:
break;
}
return NtGdiDeleteObjectApp(hObject);
Modified: trunk/reactos/dll/win32/gdi32/objects/region.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/re…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/region.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/region.c Mon Nov 5 04:50:59 2007
@@ -76,3 +76,40 @@
return CreateRectRgn(prc->left, prc->top, prc->right, prc->bottom);
}
+
+/*
+ * I thought it was okay to have this in DeleteObject but~ Speed. (jt)
+ */
+BOOL
+FASTCALL
+DeleteRegion( HRGN hRgn )
+{
+#if 0
+ PREGION_ATTR Rgn_Attr;
+
+ if ((GdiGetHandleUserData((HGDIOBJ) hRgn, (PVOID) &Rgn_Attr)) &&
+ ( Rgn_Attr != NULL ))
+ {
+ PTEB pTeb = NtCurrentTeb();
+ if (pTeb->Win32ThreadInfo != NULL)
+ {
+ if ((pTeb->GdiTebBatch.Offset + sizeof(GDIBSOBJECT)) <= GDIBATCHBUFSIZE)
+ {
+ PGDIBSOBJECT pgO = (PGDIBSOBJECT)(&pTeb->GdiTebBatch.Buffer[0] +
+ pTeb->GdiTebBatch.Offset);
+ pgO->gbHdr.Cmd = GdiBCDelRgn;
+ pgO->gbHdr.Size = sizeof(GDIBSOBJECT);
+
+ pgO->hgdiobj = (HGDIOBJ)hRgn;
+
+ pTeb->GdiTebBatch.Offset += sizeof(GDIBSSETBRHORG);
+ pTeb->GdiBatchCount++;
+ if (pTeb->GdiBatchCount >= GDI_BatchLimit) NtGdiFlush();
+ return TRUE;
+ }
+ }
+ }
+#endif
+ return NtGdiDeleteObjectApp((HGDIOBJ) hRgn);
+}
+
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c Mon Nov 5 04:50:59 2007
@@ -42,9 +42,12 @@
case GdiBCSelObj:
break;
case GdiBCDelObj:
+ case GdiBCDelRgn:
+ {
+ PGDIBSOBJECT pgO = (PGDIBSOBJECT) pHdr;
+ NtGdiDeleteObject( pgO->hgdiobj );
break;
- case GdiBCDelRgn:
- break;
+ }
default:
DC_UnlockDc(dc);
return 0;
@@ -62,6 +65,8 @@
APIENTRY
NtGdiFlush(VOID)
{
+ // Hack! FIXME!
+ NtYieldExecution(); // Force thread to sunset and run the flush.
UNIMPLEMENTED;
}
@@ -82,7 +87,11 @@
if( (GdiBatchCount > 0) && (GdiBatchCount <= GDIBATCHBUFSIZE))
{
HDC hDC = (HDC) pTeb->GdiTebBatch.HDC;
- if (hDC)
+//
+// If hDC is zero and the buffer fills up with delete objects we need to run
+// anyway. So, hard code to the system batch limit.
+//
+ if ((hDC) || (GdiBatchCount >= GDI_BATCH_LIMIT))
{
PULONG pHdr = &pTeb->GdiTebBatch.Buffer[0];
// No need to init anything, just go!