Author: jimtabor
Date: Tue Jun 17 00:19:08 2008
New Revision: 33998
URL:
http://svn.reactos.org/svn/reactos?rev=33998&view=rev
Log:
Update changes to Clip regions andregions. New support for Rao and Vis.
Modified:
trunk/reactos/subsystems/win32/win32k/include/cliprgn.h
trunk/reactos/subsystems/win32/win32k/include/intgdi.h
trunk/reactos/subsystems/win32/win32k/include/region.h
trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c
trunk/reactos/subsystems/win32/win32k/objects/dc.c
trunk/reactos/subsystems/win32/win32k/objects/region.c
Modified: trunk/reactos/subsystems/win32/win32k/include/cliprgn.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/cliprgn.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/cliprgn.h [iso-8859-1] Tue Jun 17
00:19:08 2008
@@ -5,7 +5,6 @@
#include <include/region.h>
INT FASTCALL IntGdiGetClipBox(PDC, LPRECT rc);
-INT FASTCALL IntGdiSelectVisRgn(PDC, PROSRGNDATA);
INT FASTCALL IntGdiExtSelectClipRgn (PDC, PROSRGNDATA, int);
INT FASTCALL GdiGetClipBox(HDC hDC, LPRECT rc);
Modified: trunk/reactos/subsystems/win32/win32k/include/intgdi.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/intgdi.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/intgdi.h [iso-8859-1] Tue Jun 17
00:19:08 2008
@@ -6,6 +6,7 @@
/* Brush functions */
extern HDC hSystemBM;
+extern HSEMAPHORE hsemDriverMgmt;
XLATEOBJ* FASTCALL
IntGdiCreateBrushXlate(PDC Dc, GDIBRUSHOBJ *BrushObj, BOOLEAN *Failed);
Modified: trunk/reactos/subsystems/win32/win32k/include/region.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/region.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/region.h [iso-8859-1] Tue Jun 17
00:19:08 2008
@@ -34,6 +34,13 @@
VOID FASTCALL REGION_SetRectRgn(PROSRGNDATA pRgn, INT LeftRect, INT TopRect, INT
RightRect, INT BottomRect);
BOOL INTERNAL_CALL REGION_Cleanup(PVOID ObjectBody);
+extern PROSRGNDATA prgnDefault;
+extern HRGN hrgnDefault;
+
+VOID FASTCALL REGION_Delete(PROSRGNDATA);
+VOID FASTCALL IntGdiReleaseRaoRgn(PDC);
+VOID FASTCALL IntGdiReleaseVisRgn(PDC);
+
INT STDCALL IntGdiGetRgnBox(HRGN, LPRECT);
BOOL FASTCALL IntGdiPaintRgn(PDC, HRGN );
HRGN FASTCALL GdiCreatePolyPolygonRgn(CONST PPOINT, CONST PINT, INT, INT );
Modified: trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] Tue Jun 17
00:19:08 2008
@@ -442,29 +442,22 @@
RGN_AND);
if ( Ret )
{
- TempRgn = GDIOBJ_ShareLockObj(TempRgn->BaseObject.hHmgr,
- GDI_OBJECT_TYPE_REGION);
-
GDIOBJ_ShareUnlockObjByPtr(pDC->DcLevel.prgnMeta);
if (!((PROSRGNDATA)pDC->DcLevel.prgnMeta)->BaseObject.ulShareCount)
- REGION_FreeRgn(pDC->DcLevel.prgnMeta);
+ REGION_Delete(pDC->DcLevel.prgnMeta);
pDC->DcLevel.prgnMeta = TempRgn;
GDIOBJ_ShareUnlockObjByPtr(pDC->DcLevel.prgnClip);
if (!((PROSRGNDATA)pDC->DcLevel.prgnClip)->BaseObject.ulShareCount)
- REGION_FreeRgn(pDC->DcLevel.prgnClip);
+ REGION_Delete(pDC->DcLevel.prgnClip);
pDC->DcLevel.prgnClip = NULL;
- pDC->DC_Flags |= DC_FLAG_DIRTY_RAO;
- pDC->erclClip.left = 0;
- pDC->erclClip.top = 0;
- pDC->erclClip.right = 0;
- pDC->erclClip.bottom = 0;
+ IntGdiReleaseRaoRgn(pDC);
}
else
- REGION_FreeRgn(TempRgn);
+ REGION_Delete(TempRgn);
}
}
else
@@ -510,16 +503,14 @@
if (pDC->prgnAPI)
{
- REGION_FreeRgn(pDC->prgnAPI);
- pDC->prgnAPI = REGION_AllocRgnWithHandle(1);
- REGION_SetRectRgn(pDC->prgnAPI, 0, 0, 0, 0);
+ REGION_Delete(pDC->prgnAPI);
+ pDC->prgnAPI = IntGdiCreateRectRgn(0,0,0,0);
}
if (pDC->prgnRao)
{
- REGION_FreeRgn(pDC->prgnRao);
- pDC->prgnRao = REGION_AllocRgnWithHandle(1);
- REGION_SetRectRgn(pDC->prgnRao, 0, 0, 0, 0);
+ REGION_Delete(pDC->prgnRao);
+ pDC->prgnRao = IntGdiCreateRectRgn(0,0,0,0);
}
if (pDC->DcLevel.prgnMeta && pDC->DcLevel.prgnClip)
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Tue Jun 17 00:19:08
2008
@@ -2785,7 +2785,6 @@
return &PrimarySurface;
}
-HSEMAPHORE hsemDriverMgmt = NULL; // Hax, should be in dllmain.c and global.
VOID FASTCALL
IntGdiReferencePdev(PGDIDEVICE pPDev)
Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] Tue Jun 17
00:19:08 2008
@@ -117,6 +117,9 @@
#define NDEBUG
#include <debug.h>
+
+PROSRGNDATA prgnDefault = NULL;
+HRGN hrgnDefault = NULL;
// Internal Functions
@@ -488,6 +491,7 @@
FASTCALL
REGION_Complexity( PROSRGNDATA obj )
{
+ if (!obj) return NULLREGION;
switch(obj->rdh.nCount)
{
DPRINT("Region Complexity -> %d",obj->rdh.nCount);
@@ -2074,6 +2078,73 @@
if (pRgn->Buffer && pRgn->Buffer != &pRgn->rdh.rcBound)
ExFreePool(pRgn->Buffer);
return TRUE;
+}
+
+VOID FASTCALL
+REGION_Delete(PROSRGNDATA pRgn)
+{
+ if ( pRgn == prgnDefault) return;
+ return REGION_FreeRgn(pRgn);
+}
+
+
+VOID FASTCALL
+IntGdiReleaseRaoRgn(PDC pDC)
+{
+ INT Index = GDI_HANDLE_GET_INDEX(pDC->BaseObject.hHmgr);
+ PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index];
+ pDC->DC_Flags |= DC_FLAG_DIRTY_RAO;
+ Entry->Flags |= GDI_ENTRY_FLAG_NEED_UPDATE;
+ IntGdiSetEmptyRect((PRECT)&pDC->erclClip);
+}
+
+
+VOID FASTCALL
+IntGdiReleaseVisRgn(PDC pDC)
+{
+ INT Index = GDI_HANDLE_GET_INDEX(pDC->BaseObject.hHmgr);
+ PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index];
+ pDC->DC_Flags |= DC_FLAG_DIRTY_RAO;
+ Entry->Flags |= GDI_ENTRY_FLAG_NEED_UPDATE;
+ IntGdiSetEmptyRect((PRECT)&pDC->erclClip);
+ REGION_Delete(pDC->prgnVis);
+ pDC->prgnVis = prgnDefault;
+}
+
+VOID FASTCALL
+IntUpdateVisRectRgn(PDC pDC, PROSRGNDATA pRgn)
+{
+ INT Index = GDI_HANDLE_GET_INDEX(pDC->BaseObject.hHmgr);
+ PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index];
+ PDC_ATTR pDc_Attr;
+ RECTL rcl;
+
+ if (Entry->Flags & GDI_ENTRY_FLAG_NEED_UPDATE)
+ {
+ pDc_Attr = pDC->pDc_Attr;
+ if ( !pDc_Attr ) pDc_Attr = &pDC->Dc_Attr;
+
+ pDc_Attr->VisRectRegion.Flags = REGION_Complexity(pRgn);
+
+ if (pRgn && pDc_Attr->VisRectRegion.Flags != NULLREGION)
+ {
+ rcl.left = pRgn->rdh.rcBound.left;
+ rcl.top = pRgn->rdh.rcBound.top;
+ rcl.right = pRgn->rdh.rcBound.right;
+ rcl.bottom = pRgn->rdh.rcBound.bottom;
+
+ rcl.left -= pDC->erclWindow.left;
+ rcl.top -= pDC->erclWindow.top;
+ rcl.right -= pDC->erclWindow.left;
+ rcl.bottom -= pDC->erclWindow.top;
+ }
+ else
+ IntGdiSetEmptyRect((PRECT)&rcl);
+
+ pDc_Attr->VisRectRegion.Rect = rcl;
+
+ Entry->Flags &= ~GDI_ENTRY_FLAG_NEED_UPDATE;
+ }
}
INT
@@ -2221,6 +2292,8 @@
REGION_SetRectRgn(pRgn, LeftRect, TopRect, RightRect, BottomRect);
REGION_UnlockRgn(pRgn);
+ // Return pointer with Share locks.
+ pRgn = GDIOBJ_ShareLockObj(pRgn->BaseObject.hHmgr, GDI_OBJECT_TYPE_REGION);
return pRgn;
}