Get rid of hVisRgn in ROS_DC_INFO, use prgnVis in DC instead

svn path=/branches/reactos-yarotows/; revision=46372
This commit is contained in:
Jérôme Gardou 2010-03-23 23:02:00 +00:00
parent f5cb03fb7c
commit 33f63724b1
6 changed files with 41 additions and 37 deletions

View file

@ -51,7 +51,6 @@ typedef enum
typedef struct _ROS_DC_INFO
{
HRGN hClipRgn; /* Clip region (may be 0) */
HRGN hVisRgn; /* Visible region (must never be 0) */
HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
BYTE bitsPerPixel;
@ -129,7 +128,7 @@ typedef struct _DC
RECTL erclBounds;
RECTL erclBoundsApp;
PVOID prgnAPI; /* PROSRGNDATA */
PVOID prgnVis;
PVOID prgnVis; /* Visible region (must never be 0) */
PVOID prgnRao;
POINTL ptlFillOrigin;
EBRUSHOBJ eboFill;

View file

@ -184,8 +184,8 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
Monitor->GdiDevice = pGdiDevice;
Monitor->rcMonitor.left = 0;
Monitor->rcMonitor.top = 0;
Monitor->rcMonitor.right = Monitor->rcMonitor.left + pGdiDevice->gdiinfo.ulHorzRes;
Monitor->rcMonitor.top = 0;
Monitor->rcMonitor.right = Monitor->rcMonitor.left + pGdiDevice->gdiinfo.ulHorzRes;
Monitor->rcMonitor.bottom = Monitor->rcMonitor.top + pGdiDevice->gdiinfo.ulVertRes;
Monitor->rcWork = Monitor->rcMonitor;
Monitor->cWndStack = 0;
@ -506,7 +506,7 @@ NtUserEnumDisplayMonitors(
/* FIXME: setlasterror? */
return -1;
}
dcVisRgn = dc->rosdc.hVisRgn;
dcVisRgn = ((PROSRGNDATA)dc->prgnVis)->BaseObject.hHmgr;
DC_UnlockDc(dc);
regionType = NtGdiGetRgnBox(dcVisRgn, &dcRect);

View file

@ -1206,7 +1206,7 @@ UserScrollDC(
{
return FALSE;
}
hrgnVisible = pDC->rosdc.hVisRgn; // pDC->prgnRao?
hrgnVisible = ((PROSRGNDATA)pDC->prgnVis)->BaseObject.hHmgr; // pDC->prgnRao?
DC_UnlockDc(pDC);
/* Begin with the shifted and then clipped scroll rect */

View file

@ -26,22 +26,28 @@ int FASTCALL
CLIPPING_UpdateGCRegion(DC* Dc)
{
PROSRGNDATA CombinedRegion;
HRGN hRgnVis = NULL;
// would prefer this, but the rest of the code sucks
// ASSERT(Dc->rosdc.hGCClipRgn);
// ASSERT(Dc->rosdc.hClipRgn);
if (!Dc->rosdc.hVisRgn)
if (!Dc->prgnVis)
{
DPRINT1("Warning, hVisRgn is NULL!\n");
DPRINT1("Warning, prgnVis is NULL!\n");
}
else
{
hRgnVis = ((PROSRGNDATA)Dc->prgnVis)->BaseObject.hHmgr ;
}
if (Dc->rosdc.hGCClipRgn == NULL)
Dc->rosdc.hGCClipRgn = IntSysCreateRectRgn(0, 0, 0, 0);
if (Dc->rosdc.hClipRgn == NULL)
NtGdiCombineRgn(Dc->rosdc.hGCClipRgn, Dc->rosdc.hVisRgn, 0, RGN_COPY);
NtGdiCombineRgn(Dc->rosdc.hGCClipRgn, ((PROSRGNDATA)Dc->prgnVis)->BaseObject.hHmgr, 0, RGN_COPY);
else // FYI: Vis == NULL! source of "IntGdiCombineRgn requires hSrc2 != NULL for combine mode 1!"
NtGdiCombineRgn(Dc->rosdc.hGCClipRgn, Dc->rosdc.hClipRgn, Dc->rosdc.hVisRgn, RGN_AND);
NtGdiCombineRgn(Dc->rosdc.hGCClipRgn, Dc->rosdc.hClipRgn, hRgnVis, RGN_AND);
NtGdiOffsetRgn(Dc->rosdc.hGCClipRgn, Dc->ptlDCOrig.x, Dc->ptlDCOrig.y);
if((CombinedRegion = RGNOBJAPI_Lock(Dc->rosdc.hGCClipRgn, NULL)))
@ -84,17 +90,17 @@ GdiSelectVisRgn(HDC hdc, HRGN hrgn)
}
dc->fs &= ~DC_FLAG_DIRTY_RAO;
if (dc->rosdc.hVisRgn == NULL)
if (dc->prgnVis == NULL)
{
dc->rosdc.hVisRgn = IntSysCreateRectRgn(0, 0, 0, 0);
GDIOBJ_CopyOwnership(hdc, dc->rosdc.hVisRgn);
dc->prgnVis = IntSysCreateRectpRgn(0, 0, 0, 0);
GDIOBJ_CopyOwnership(hdc, ((PROSRGNDATA)dc->prgnVis)->BaseObject.hHmgr);
}
retval = NtGdiCombineRgn(dc->rosdc.hVisRgn, hrgn, 0, RGN_COPY);
retval = NtGdiCombineRgn(((PROSRGNDATA)dc->prgnVis)->BaseObject.hHmgr, hrgn, 0, RGN_COPY);
if ( retval != ERROR )
{
NtGdiOffsetRgn(dc->rosdc.hVisRgn, -dc->ptlDCOrig.x, -dc->ptlDCOrig.y);
NtGdiOffsetRgn(((PROSRGNDATA)dc->prgnVis)->BaseObject.hHmgr, -dc->ptlDCOrig.x, -dc->ptlDCOrig.y);
CLIPPING_UpdateGCRegion(dc);
}
DC_UnlockDc(dc);
@ -131,7 +137,7 @@ int FASTCALL GdiExtSelectClipRgn(PDC dc,
{
PROSRGNDATA Rgn;
RECTL rect;
if((Rgn = RGNOBJAPI_Lock(dc->rosdc.hVisRgn, NULL)))
if((Rgn = RGNOBJAPI_Lock(((PROSRGNDATA)dc->prgnVis)->BaseObject.hHmgr, NULL)))
{
REGION_GetRgnBox(Rgn, &rect);
RGNOBJAPI_Unlock(Rgn);
@ -263,7 +269,7 @@ int APIENTRY NtGdiExcludeClipRect(HDC hDC,
if (!dc->rosdc.hClipRgn)
{
dc->rosdc.hClipRgn = IntSysCreateRectRgn(0, 0, 0, 0);
NtGdiCombineRgn(dc->rosdc.hClipRgn, dc->rosdc.hVisRgn, NewRgn, RGN_DIFF);
NtGdiCombineRgn(dc->rosdc.hClipRgn, ((PROSRGNDATA)dc->prgnVis)->BaseObject.hHmgr, NewRgn, RGN_DIFF);
Result = SIMPLEREGION;
}
else
@ -428,7 +434,7 @@ BOOL APIENTRY NtGdiRectVisible(HDC hDC,
}
int
FASTCALL
FASTCALL
IntGdiSetMetaRgn(PDC pDC)
{
INT Ret = ERROR;
@ -440,7 +446,7 @@ IntGdiSetMetaRgn(PDC pDC)
{
TempRgn = IntSysCreateRectRgn(0,0,0,0);
if (TempRgn)
{
{
Ret = IntGdiCombineRgn( TempRgn,
pDC->dclevel.prgnMeta,
pDC->dclevel.prgnClip,
@ -476,7 +482,7 @@ IntGdiSetMetaRgn(PDC pDC)
pDC->dclevel.prgnMeta = pDC->dclevel.prgnClip;
pDC->dclevel.prgnClip = NULL;
}
else
else
Ret = SIMPLEREGION;
}
return Ret;
@ -517,7 +523,7 @@ NEW_CLIPPING_UpdateGCRegion(PDC pDC)
REGION_Delete(pDC->prgnRao);
pDC->prgnRao = IntSysCreateRectRgn(0,0,0,0);
}
if (pDC->dclevel.prgnMeta && pDC->dclevel.prgnClip)
{
IntGdiCombineRgn( pDC->prgnAPI,
@ -548,7 +554,7 @@ NEW_CLIPPING_UpdateGCRegion(PDC pDC)
pDC->fs &= ~DC_FLAG_DIRTY_RAO;
// if (Dc->CombinedClip != NULL) IntEngDeleteClipRegion(Dc->CombinedClip);
co = IntEngCreateClipRegion( ((PROSRGNDATA)pDC->prgnRao)->rdh.nCount,
((PROSRGNDATA)pDC->prgnRao)->Buffer,
&pDC->erclClip);

View file

@ -105,7 +105,7 @@ DC_InitHack(PDC pdc)
ASSERT(hVisRgn);
GdiSelectVisRgn(pdc->BaseObject.hHmgr, hVisRgn);
GreDeleteObject(hVisRgn);
ASSERT(pdc->rosdc.hVisRgn);
ASSERT(pdc->prgnVis);
pdc->rosdc.bitsPerPixel = pdc->ppdev->gdiinfo.cBitsPixel *
pdc->ppdev->gdiinfo.cPlanes;
}
@ -362,8 +362,8 @@ DC_Cleanup(PVOID ObjectBody)
/* Free regions */
if (pdc->rosdc.hClipRgn)
GreDeleteObject(pdc->rosdc.hClipRgn);
if (pdc->rosdc.hVisRgn)
GreDeleteObject(pdc->rosdc.hVisRgn);
if (pdc->prgnVis)
REGION_FreeRgnByHandle(((PROSRGNDATA)pdc->prgnVis)->BaseObject.hHmgr);
ASSERT(pdc->rosdc.hGCClipRgn);
if (pdc->rosdc.hGCClipRgn)
GreDeleteObject(pdc->rosdc.hGCClipRgn);
@ -412,14 +412,14 @@ DC_SetOwnership(HDC hDC, PEPROCESS Owner)
//
if (!GDIOBJ_SetOwnership(pDC->rosdc.hClipRgn, Owner)) return FALSE;
}
if (pDC->rosdc.hVisRgn)
if (pDC->prgnVis)
{ // FIXME! HAX!!!
Index = GDI_HANDLE_GET_INDEX(pDC->rosdc.hVisRgn);
Index = GDI_HANDLE_GET_INDEX(((PROSRGNDATA)pDC->prgnVis)->BaseObject.hHmgr);
Entry = &GdiHandleTable->Entries[Index];
if (Entry->UserData) FreeObjectAttr(Entry->UserData);
Entry->UserData = NULL;
//
if (!GDIOBJ_SetOwnership(pDC->rosdc.hVisRgn, Owner)) return FALSE;
if (!GDIOBJ_SetOwnership(((PROSRGNDATA)pDC->prgnVis)->BaseObject.hHmgr, Owner)) return FALSE;
}
if (pDC->rosdc.hGCClipRgn)
{ // FIXME! HAX!!!

View file

@ -2035,13 +2035,13 @@ REGION_AllocRgnWithHandle(INT nReg)
{
HRGN hReg;
PROSRGNDATA pReg;
pReg = (PROSRGNDATA)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_REGION);
if(!pReg)
{
return NULL;
}
hReg = pReg->BaseObject.hHmgr;
if (nReg == 0 || nReg == 1)
@ -2419,7 +2419,7 @@ IntGdiPaintRgn(
if (!(tmpVisRgn = IntSysCreateRectRgn(0, 0, 0, 0))) return FALSE;
// Transform region into device co-ords
if (!REGION_LPTODP(dc, tmpVisRgn, hRgn) ||
if (!REGION_LPTODP(dc, tmpVisRgn, hRgn) ||
NtGdiOffsetRgn(tmpVisRgn, dc->ptlDCOrig.x, dc->ptlDCOrig.y) == ERROR)
{
REGION_FreeRgnByHandle(tmpVisRgn);
@ -2552,13 +2552,13 @@ REGION_SetRectRgn(
}
}
INT
INT
FASTCALL
IntGdiOffsetRgn(
PROSRGNDATA rgn,
INT XOffset,
INT YOffset )
{
{
if (XOffset || YOffset)
{
int nbox = rgn->rdh.nCount;
@ -3444,7 +3444,7 @@ NtGdiEqualRgn(
if ( rgn1->rdh.nCount == 0 )
{
bRet = TRUE;
goto exit;
goto exit;
}
if ( rgn1->rdh.rcBound.left != rgn2->rdh.rcBound.left ||
@ -3691,8 +3691,7 @@ NtGdiGetRandomRgn(
else if (pDC->dclevel.prgnMeta) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.hHmgr;
break;
case SYSRGN:
hSrc = pDC->rosdc.hVisRgn;
// if (pDC->prgnVis) hSrc = ((PROSRGNDATA)pDC->prgnVis)->BaseObject.hHmgr;
if (pDC->prgnVis) hSrc = ((PROSRGNDATA)pDC->prgnVis)->BaseObject.hHmgr;
break;
default:
hSrc = 0;