Author: fireball
Date: Wed Apr 14 22:23:38 2010
New Revision: 46871
URL:
http://svn.reactos.org/svn/reactos?rev=46871&view=rev
Log:
- Add a clipping region cache to the usermode DC structure and use it in SetDeviceClipping
calls instead of creating an empty region all the time. Speed increase and also it's
needed for further text output improvements.
Modified:
branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c
branches/arwinss/reactos/include/psdk/ntrosgdi.h
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Wed Apr 14
22:23:38 2010
@@ -229,6 +229,10 @@
/* No font is selected */
physDev->cache_index = -1;
+ /* Create a usermode clipping region (same as kernelmode one, just to reduce
+ amount of syscalls) */
+ physDev->region = CreateRectRgn( 0, 0, 0, 0 );
+
/* Return allocated physical DC to the caller */
*pdev = physDev;
@@ -262,6 +266,9 @@
BOOL CDECL RosDrv_DeleteDC( NTDRV_PDEVICE *physDev )
{
BOOL res;
+
+ /* Delete usermode copy of a clipping region */
+ DeleteObject( physDev->region );
/* Delete kernel DC */
res = RosGdiDeleteDC(physDev->hKernelDC);
@@ -798,37 +805,25 @@
void CDECL RosDrv_SetDeviceClipping( NTDRV_PDEVICE *physDev, HRGN vis_rgn, HRGN clip_rgn
)
{
RGNDATA *data;
- HRGN dc_rgn;
DWORD size;
//FIXME("SetDeviceClipping hdc %x\n", physDev->hUserDC);
- /* Create a dummy region (FIXME: create it once!) */
- dc_rgn = CreateRectRgn(0,0,0,0);
- if (!dc_rgn) return;
-
- /* Update dcRegion to become a combined region */
- CombineRgn( dc_rgn, vis_rgn, clip_rgn, clip_rgn ? RGN_AND : RGN_COPY );
+ /* Update dc region to become a combined region */
+ CombineRgn( physDev->region, vis_rgn, clip_rgn, clip_rgn ? RGN_AND : RGN_COPY );
/* Get region data size */
- if (!(size = GetRegionData( dc_rgn, 0, NULL )))
- {
- DeleteObject(dc_rgn);
+ if (!(size = GetRegionData( physDev->region, 0, NULL )))
return;
- }
/* Allocate memory for it */
if (!(data = HeapAlloc( GetProcessHeap(), 0, size )))
- {
- DeleteObject(dc_rgn);
return;
- }
/* Get region data */
- if (!GetRegionData( dc_rgn, size, data ))
+ if (!GetRegionData( physDev->region, size, data ))
{
HeapFree( GetProcessHeap(), 0, data );
- DeleteObject(dc_rgn);
return;
}
@@ -837,7 +832,6 @@
/* Free memory and delete clipping region */
HeapFree( GetProcessHeap(), 0, data );
- DeleteObject(dc_rgn);
}
BOOL CDECL RosDrv_SetDeviceGammaRamp(NTDRV_PDEVICE *physDev, LPVOID ramp)
Modified: branches/arwinss/reactos/include/psdk/ntrosgdi.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/psdk/nt…
==============================================================================
--- branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] Wed Apr 14 22:23:38
2010
@@ -10,9 +10,10 @@
typedef struct _NTDRV_PDEVICE
{
- HDC hUserDC;
- HDC hKernelDC;
- int cache_index; /* cache of a currently selected font */
+ HDC hUserDC;
+ HDC hKernelDC;
+ HRGN region; /* Device region (visible region & clip region) */
+ int cache_index; /* cache of a currently selected font */
} NTDRV_PDEVICE, *PNTDRV_PDEVICE;
typedef struct _ROS_DCINFO