- Improve the WNDOBJ/CLIPOBJ hack by using the same internal structure for both object.
This way a driver can enumerate WNDOBJ::coClient safely.
Also take this as an opportunity to get rid of DC::ros_dc.

svn path=/trunk/; revision=63739
This commit is contained in:
Jérôme Gardou 2014-07-26 15:41:08 +00:00
parent f00899b378
commit 4069d63c30
21 changed files with 182 additions and 209 deletions

View file

@ -14,7 +14,17 @@
XCLIPOBJ gxcoTrivial = XCLIPOBJ gxcoTrivial =
{ {
{0, {LONG_MIN, LONG_MIN, LONG_MAX, LONG_MAX}, DC_TRIVIAL, FC_RECT, TC_RECTANGLES, 0}, /* CLIPOBJ */
{
{
0, /* iUniq */
{LONG_MIN, LONG_MIN, LONG_MAX, LONG_MAX}, /* rclBounds */
DC_TRIVIAL, /* idCOmplexity */
FC_RECT, /* iFComplexity */
TC_RECTANGLES, /* iMode */
0 /* fjOptions */
},
},
0, 0, 0 0, 0, 0
}; };

View file

@ -190,49 +190,50 @@ CompareSpans(
VOID VOID
FASTCALL FASTCALL
IntEngDeleteClipRegion(CLIPOBJ *ClipObj) IntEngInitClipObj(XCLIPOBJ *Clip)
{ {
EngFreeMem(ObjToGDI(ClipObj, CLIP)); Clip->Rects = &Clip->ClipObj.rclBounds;
} }
CLIPOBJ* VOID FASTCALL
FASTCALL IntEngFreeClipResources(XCLIPOBJ *Clip)
IntEngCreateClipRegion(ULONG count, PRECTL pRect, PRECTL rcBounds)
{ {
CLIPGDI *Clip; if (Clip->Rects != &Clip->ClipObj.rclBounds)
EngFreeMem(Clip->Rects);
}
VOID
FASTCALL
IntEngUpdateClipRegion(
XCLIPOBJ* Clip,
ULONG count,
const RECTL* pRect,
const RECTL* rcBounds)
{
if(count > 1) if(count > 1)
{ {
RECTL *dest; RECTL* NewRects = EngAllocMem(0, FIELD_OFFSET(ENUMRECTS, arcl[count]), GDITAG_CLIPOBJ);
Clip = EngAllocMem(0, sizeof(CLIPGDI) + ((count - 1) * sizeof(RECTL)), GDITAG_CLIPOBJ); if(NewRects != NULL)
if(Clip != NULL)
{ {
Clip->EnumRects.c = count; Clip->RectCount = count;
Clip->EnumOrder = CD_ANY; Clip->EnumOrder = CD_ANY;
for(dest = Clip->EnumRects.arcl;count > 0; count--, dest++, pRect++) RtlCopyMemory(NewRects, pRect, count * sizeof(RECTL));
{
*dest = *pRect;
}
Clip->ClipObj.iDComplexity = DC_COMPLEX; Clip->ClipObj.iDComplexity = DC_COMPLEX;
Clip->ClipObj.iFComplexity = ((Clip->EnumRects.c <= 4) ? FC_RECT4 : FC_COMPLEX); Clip->ClipObj.iFComplexity = ((Clip->RectCount <= 4) ? FC_RECT4 : FC_COMPLEX);
Clip->ClipObj.iMode = TC_RECTANGLES; Clip->ClipObj.iMode = TC_RECTANGLES;
Clip->ClipObj.rclBounds = *rcBounds; Clip->ClipObj.rclBounds = *rcBounds;
return GDIToObj(Clip, CLIP); if (Clip->Rects != &Clip->ClipObj.rclBounds)
EngFreeMem(Clip->Rects);
Clip->Rects = NewRects;
} }
} }
else else
{ {
Clip = EngAllocMem(0, sizeof(CLIPGDI), GDITAG_CLIPOBJ);
if(Clip != NULL)
{
Clip->EnumRects.c = 1;
Clip->EnumOrder = CD_ANY; Clip->EnumOrder = CD_ANY;
Clip->EnumRects.arcl[0] = *rcBounds;
Clip->ClipObj.iDComplexity = (((rcBounds->top == rcBounds->bottom) && Clip->ClipObj.iDComplexity = (((rcBounds->top == rcBounds->bottom) &&
(rcBounds->left == rcBounds->right)) (rcBounds->left == rcBounds->right))
@ -241,14 +242,13 @@ IntEngCreateClipRegion(ULONG count, PRECTL pRect, PRECTL rcBounds)
Clip->ClipObj.iFComplexity = FC_RECT; Clip->ClipObj.iFComplexity = FC_RECT;
Clip->ClipObj.iMode = TC_RECTANGLES; Clip->ClipObj.iMode = TC_RECTANGLES;
Clip->ClipObj.rclBounds = *rcBounds; Clip->ClipObj.rclBounds = *rcBounds;
Clip->RectCount = 1;
return GDIToObj(Clip, CLIP); if (Clip->Rects != &Clip->ClipObj.rclBounds)
EngFreeMem(Clip->Rects);
Clip->Rects = &Clip->ClipObj.rclBounds;
} }
} }
return NULL;
}
/* /*
* @implemented * @implemented
*/ */
@ -259,7 +259,8 @@ EngCreateClip(VOID)
CLIPGDI *Clip = EngAllocMem(FL_ZERO_MEMORY, sizeof(CLIPGDI), GDITAG_CLIPOBJ); CLIPGDI *Clip = EngAllocMem(FL_ZERO_MEMORY, sizeof(CLIPGDI), GDITAG_CLIPOBJ);
if(Clip != NULL) if(Clip != NULL)
{ {
return GDIToObj(Clip, CLIP); Clip->Rects = &Clip->ClipObj.rclBounds;
return &Clip->ClipObj;
} }
return NULL; return NULL;
@ -273,7 +274,10 @@ APIENTRY
EngDeleteClip( EngDeleteClip(
_In_ _Post_ptr_invalid_ CLIPOBJ *pco) _In_ _Post_ptr_invalid_ CLIPOBJ *pco)
{ {
EngFreeMem(ObjToGDI(pco, CLIP)); XCLIPOBJ* Clip = CONTAINING_RECORD(pco, XCLIPOBJ, ClipObj);
if (Clip->Rects != &Clip->ClipObj.rclBounds)
EngFreeMem(Clip->Rects);
EngFreeMem(Clip);
} }
/* /*
@ -288,13 +292,13 @@ CLIPOBJ_cEnumStart(
_In_ ULONG iDirection, _In_ ULONG iDirection,
_In_ ULONG cMaxRects) _In_ ULONG cMaxRects)
{ {
CLIPGDI *ClipGDI = ObjToGDI(pco, CLIP); XCLIPOBJ* Clip = CONTAINING_RECORD(pco, XCLIPOBJ, ClipObj);
SORTCOMP CompareFunc; SORTCOMP CompareFunc;
ClipGDI->EnumPos = 0; Clip->EnumPos = 0;
ClipGDI->EnumMax = (cMaxRects > 0) ? cMaxRects : ClipGDI->EnumRects.c; Clip->EnumMax = (cMaxRects > 0) ? cMaxRects : Clip->RectCount;
if (CD_ANY != iDirection && ClipGDI->EnumOrder != iDirection) if (CD_ANY != iDirection && Clip->EnumOrder != iDirection)
{ {
switch (iDirection) switch (iDirection)
{ {
@ -316,26 +320,26 @@ CLIPOBJ_cEnumStart(
default: default:
DPRINT1("Invalid iDirection %lu\n", iDirection); DPRINT1("Invalid iDirection %lu\n", iDirection);
iDirection = ClipGDI->EnumOrder; iDirection = Clip->EnumOrder;
CompareFunc = NULL; CompareFunc = NULL;
break; break;
} }
if (NULL != CompareFunc) if (NULL != CompareFunc)
{ {
EngSort((PBYTE) ClipGDI->EnumRects.arcl, sizeof(RECTL), ClipGDI->EnumRects.c, CompareFunc); EngSort((PBYTE) Clip->Rects, sizeof(RECTL), Clip->RectCount, CompareFunc);
} }
ClipGDI->EnumOrder = iDirection; Clip->EnumOrder = iDirection;
} }
/* Return the number of rectangles enumerated */ /* Return the number of rectangles enumerated */
if ((cMaxRects > 0) && (ClipGDI->EnumRects.c > cMaxRects)) if ((cMaxRects > 0) && (Clip->RectCount > cMaxRects))
{ {
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
return ClipGDI->EnumRects.c; return Clip->RectCount;
} }
/* /*
@ -348,14 +352,14 @@ CLIPOBJ_bEnum(
_In_ ULONG cj, _In_ ULONG cj,
_Out_bytecap_(cj) ULONG *pulEnumRects) _Out_bytecap_(cj) ULONG *pulEnumRects)
{ {
RECTL *dest, *src; const RECTL* src;
CLIPGDI *ClipGDI = ObjToGDI(pco, CLIP); XCLIPOBJ* Clip = CONTAINING_RECORD(pco, XCLIPOBJ, ClipObj);
ULONG nCopy, i; ULONG nCopy;
ENUMRECTS* pERects = (ENUMRECTS*)pulEnumRects; ENUMRECTS* pERects = (ENUMRECTS*)pulEnumRects;
// Calculate how many rectangles we should copy // Calculate how many rectangles we should copy
nCopy = min( ClipGDI->EnumMax - ClipGDI->EnumPos, nCopy = min( Clip->EnumMax - Clip->EnumPos,
min( ClipGDI->EnumRects.c - ClipGDI->EnumPos, min( Clip->RectCount - Clip->EnumPos,
(cj - sizeof(ULONG)) / sizeof(RECTL))); (cj - sizeof(ULONG)) / sizeof(RECTL)));
if(nCopy == 0) if(nCopy == 0)
@ -364,17 +368,14 @@ CLIPOBJ_bEnum(
} }
/* Copy rectangles */ /* Copy rectangles */
src = ClipGDI->EnumRects.arcl + ClipGDI->EnumPos; src = &Clip->Rects[Clip->EnumPos];
for(i = 0, dest = pERects->arcl; i < nCopy; i++, dest++, src++) RtlCopyMemory(pERects->arcl, src, nCopy * sizeof(RECTL));
{
*dest = *src;
}
pERects->c = nCopy; pERects->c = nCopy;
ClipGDI->EnumPos+=nCopy; Clip->EnumPos+=nCopy;
return ClipGDI->EnumPos < ClipGDI->EnumRects.c; return Clip->EnumPos < Clip->RectCount;
} }
/* EOF */ /* EOF */

View file

@ -68,11 +68,22 @@ typedef struct _XCLIPOBJ
} }
*/ */
typedef struct _CLIPGDI { typedef struct _CLIPGDI {
union
{
CLIPOBJ ClipObj; CLIPOBJ ClipObj;
WNDOBJ WndObj;
};
/* WNDOBJ part */
HWND Hwnd;
WNDOBJCHANGEPROC ChangeProc;
FLONG Flags;
int PixelFormat;
/* CLIPOBJ part */
ULONG EnumPos; ULONG EnumPos;
ULONG EnumOrder; ULONG EnumOrder;
ULONG EnumMax; ULONG EnumMax;
ENUMRECTS EnumRects; ULONG RectCount;
RECTL* Rects;
} CLIPGDI, *PCLIPGDI; } CLIPGDI, *PCLIPGDI;
// HACK, until we use the original structure // HACK, until we use the original structure
@ -112,15 +123,6 @@ typedef struct _PATHGDI {
PATHOBJ PathObj; PATHOBJ PathObj;
} PATHGDI; } PATHGDI;
typedef struct _WNDGDI {
WNDOBJ WndObj;
HWND Hwnd;
CLIPOBJ *ClientClipObj;
WNDOBJCHANGEPROC ChangeProc;
FLONG Flags;
int PixelFormat;
} WNDGDI, *PWNDGDI;
typedef struct _XFORMGDI { typedef struct _XFORMGDI {
ULONG Dummy; ULONG Dummy;
/* XFORMOBJ has no public members */ /* XFORMOBJ has no public members */

View file

@ -21,15 +21,15 @@ IntEngWndCallChangeProc(
IN WNDOBJ *pwo, IN WNDOBJ *pwo,
IN FLONG flChanged) IN FLONG flChanged)
{ {
WNDGDI *WndObjInt = ObjToGDI(pwo, WND); XCLIPOBJ* Clip = CONTAINING_RECORD(pwo, XCLIPOBJ, WndObj);
if (WndObjInt->ChangeProc == NULL) if (Clip->ChangeProc == NULL)
{ {
return; return;
} }
/* check flags of the WNDOBJ */ /* check flags of the WNDOBJ */
flChanged &= WndObjInt->Flags; flChanged &= Clip->Flags;
if (flChanged == 0) if (flChanged == 0)
{ {
return; return;
@ -42,8 +42,8 @@ IntEngWndCallChangeProc(
} }
TRACE("Calling WNDOBJCHANGEPROC (0x%p), Changed = 0x%x\n", TRACE("Calling WNDOBJCHANGEPROC (0x%p), Changed = 0x%x\n",
WndObjInt->ChangeProc, flChanged); Clip->ChangeProc, flChanged);
WndObjInt->ChangeProc(pwo, flChanged); Clip->ChangeProc(pwo, flChanged);
} }
/* /*
@ -52,13 +52,11 @@ IntEngWndCallChangeProc(
BOOLEAN BOOLEAN
FASTCALL FASTCALL
IntEngWndUpdateClipObj( IntEngWndUpdateClipObj(
WNDGDI *WndObjInt, XCLIPOBJ* Clip,
PWND Window) PWND Window)
{ {
HRGN hVisRgn; HRGN hVisRgn;
PROSRGNDATA visRgn; PROSRGNDATA visRgn;
CLIPOBJ *ClipObj = NULL;
CLIPOBJ *OldClipObj;
TRACE("IntEngWndUpdateClipObj\n"); TRACE("IntEngWndUpdateClipObj\n");
@ -70,8 +68,7 @@ IntEngWndUpdateClipObj(
{ {
if (visRgn->rdh.nCount > 0) if (visRgn->rdh.nCount > 0)
{ {
ClipObj = IntEngCreateClipRegion(visRgn->rdh.nCount, visRgn->Buffer, IntEngUpdateClipRegion(Clip, visRgn->rdh.nCount, visRgn->Buffer, &visRgn->rdh.rcBound);
&visRgn->rdh.rcBound);
TRACE("Created visible region with %lu rects\n", visRgn->rdh.nCount); TRACE("Created visible region with %lu rects\n", visRgn->rdh.nCount);
TRACE(" BoundingRect: %d, %d %d, %d\n", TRACE(" BoundingRect: %d, %d %d, %d\n",
visRgn->rdh.rcBound.left, visRgn->rdh.rcBound.top, visRgn->rdh.rcBound.left, visRgn->rdh.rcBound.top,
@ -95,28 +92,13 @@ IntEngWndUpdateClipObj(
GreDeleteObject(hVisRgn); GreDeleteObject(hVisRgn);
} }
else else
{
WARN("VIS_ComputeVisibleRegion failed!\n");
}
if (ClipObj == NULL)
{ {
/* Fall back to client rect */ /* Fall back to client rect */
ClipObj = IntEngCreateClipRegion(1, &Window->rcClient, IntEngUpdateClipRegion(Clip, 1, &Window->rcClient, &Window->rcClient);
&Window->rcClient);
} }
if (ClipObj == NULL) /* Update the WNDOBJ */
{ Clip->WndObj.rclClient = Window->rcClient;
ERR("IntEngCreateClipRegion() failed!\n");
return FALSE;
}
RtlCopyMemory(&WndObjInt->WndObj.coClient, ClipObj, sizeof (CLIPOBJ));
RtlCopyMemory(&WndObjInt->WndObj.rclClient, &Window->rcClient, sizeof (RECT));
OldClipObj = InterlockedExchangePointer((PVOID*)&WndObjInt->ClientClipObj, ClipObj);
if (OldClipObj != NULL)
IntEngDeleteClipRegion(OldClipObj);
return TRUE; return TRUE;
} }
@ -131,7 +113,7 @@ IntEngWindowChanged(
_In_ FLONG flChanged) _In_ FLONG flChanged)
{ {
PPROPERTY pprop; PPROPERTY pprop;
WNDGDI *Current; XCLIPOBJ *Current;
HWND hWnd; HWND hWnd;
ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL);
@ -142,7 +124,7 @@ IntEngWindowChanged(
{ {
return; return;
} }
Current = (WNDGDI *)pprop->Data; Current = (XCLIPOBJ *)pprop->Data;
if ( gcountPWO && if ( gcountPWO &&
Current && Current &&
Current->Hwnd == hWnd && Current->Hwnd == hWnd &&
@ -184,7 +166,7 @@ EngCreateWnd(
FLONG fl, FLONG fl,
int iPixelFormat) int iPixelFormat)
{ {
WNDGDI *WndObjInt = NULL; XCLIPOBJ *Clip = NULL;
WNDOBJ *WndObjUser = NULL; WNDOBJ *WndObjUser = NULL;
PWND Window; PWND Window;
BOOL calledFromUser; BOOL calledFromUser;
@ -206,34 +188,34 @@ EngCreateWnd(
} }
/* Create WNDOBJ */ /* Create WNDOBJ */
WndObjInt = EngAllocMem(0, sizeof (WNDGDI), GDITAG_WNDOBJ); Clip = EngAllocMem(FL_ZERO_MEMORY, sizeof (XCLIPOBJ), GDITAG_WNDOBJ);
if (WndObjInt == NULL) if (Clip == NULL)
{ {
ERR("Failed to allocate memory for a WND structure!\n"); ERR("Failed to allocate memory for a WND structure!\n");
RETURN( NULL); RETURN( NULL);
} }
IntEngInitClipObj(Clip);
/* Fill the clipobj */ /* Fill the clipobj */
WndObjInt->ClientClipObj = NULL; if (!IntEngWndUpdateClipObj(Clip, Window))
if (!IntEngWndUpdateClipObj(WndObjInt, Window))
{ {
EngFreeMem(WndObjInt); EngFreeMem(Clip);
RETURN( NULL); RETURN( NULL);
} }
/* Fill user object */ /* Fill user object */
WndObjUser = GDIToObj(WndObjInt, WND); WndObjUser = &Clip->WndObj;
WndObjUser->psoOwner = pso; WndObjUser->psoOwner = pso;
WndObjUser->pvConsumer = NULL; WndObjUser->pvConsumer = NULL;
/* Fill internal object */ /* Fill internal object */
WndObjInt->Hwnd = hWnd; Clip->Hwnd = hWnd;
WndObjInt->ChangeProc = pfn; Clip->ChangeProc = pfn;
WndObjInt->Flags = fl; Clip->Flags = fl;
WndObjInt->PixelFormat = iPixelFormat; Clip->PixelFormat = iPixelFormat;
/* associate object with window */ /* associate object with window */
IntSetProp(Window, AtomWndObj, WndObjInt); IntSetProp(Window, AtomWndObj, Clip);
++gcountPWO; ++gcountPWO;
TRACE("EngCreateWnd: SUCCESS!\n"); TRACE("EngCreateWnd: SUCCESS!\n");
@ -258,7 +240,7 @@ APIENTRY
EngDeleteWnd( EngDeleteWnd(
IN WNDOBJ *pwo) IN WNDOBJ *pwo)
{ {
WNDGDI *WndObjInt = ObjToGDI(pwo, WND); XCLIPOBJ* Clip = CONTAINING_RECORD(pwo, XCLIPOBJ, WndObj);
PWND Window; PWND Window;
BOOL calledFromUser; BOOL calledFromUser;
@ -270,7 +252,7 @@ EngDeleteWnd(
} }
/* Get window object */ /* Get window object */
Window = UserGetWindowObject(WndObjInt->Hwnd); Window = UserGetWindowObject(Clip->Hwnd);
if (Window == NULL) if (Window == NULL)
{ {
ERR("Couldnt get window object for WndObjInt->Hwnd!!!\n"); ERR("Couldnt get window object for WndObjInt->Hwnd!!!\n");
@ -287,8 +269,8 @@ EngDeleteWnd(
} }
/* Free resources */ /* Free resources */
IntEngDeleteClipRegion(WndObjInt->ClientClipObj); IntEngFreeClipResources(Clip);
EngFreeMem(WndObjInt); EngFreeMem(Clip);
} }
@ -302,14 +284,8 @@ WNDOBJ_bEnum(
IN ULONG cj, IN ULONG cj,
OUT ULONG *pul) OUT ULONG *pul)
{ {
WNDGDI *WndObjInt = ObjToGDI(pwo, WND); /* Relay */
BOOL Ret; return CLIPOBJ_bEnum(&pwo->coClient, cj, pul);
TRACE("WNDOBJ_bEnum: pwo = 0x%p, cj = %lu, pul = 0x%p\n", pwo, cj, pul);
Ret = CLIPOBJ_bEnum(WndObjInt->ClientClipObj, cj, pul);
TRACE("WNDOBJ_bEnum: Returning %s\n", Ret ? "True" : "False");
return Ret;
} }
@ -324,17 +300,9 @@ WNDOBJ_cEnumStart(
IN ULONG iDirection, IN ULONG iDirection,
IN ULONG cLimit) IN ULONG cLimit)
{ {
WNDGDI *WndObjInt = ObjToGDI(pwo, WND); /* Relay */
ULONG Ret; // FIXME: Should we enumerate all rectangles or not?
return CLIPOBJ_cEnumStart(&pwo->coClient, FALSE, iType, iDirection, cLimit);
TRACE("WNDOBJ_cEnumStart: pwo = 0x%p, iType = %lu, iDirection = %lu, cLimit = %lu\n",
pwo, iType, iDirection, cLimit);
/* FIXME: Should we enumerate all rectangles or not? */
Ret = CLIPOBJ_cEnumStart(WndObjInt->ClientClipObj, FALSE, iType, iDirection, cLimit);
TRACE("WNDOBJ_cEnumStart: Returning 0x%lx\n", Ret);
return Ret;
} }

View file

@ -114,13 +114,17 @@ IntEngPolyline(SURFOBJ *DestSurf,
LONG dCount, LONG dCount,
MIX mix); MIX mix);
CLIPOBJ* FASTCALL VOID FASTCALL
IntEngCreateClipRegion(ULONG count, IntEngUpdateClipRegion(XCLIPOBJ* Clip,
PRECTL pRect, ULONG count,
PRECTL rcBounds); const RECTL* pRect,
const RECTL* rcBounds);
VOID FASTCALL VOID FASTCALL
IntEngDeleteClipRegion(CLIPOBJ *ClipObj); IntEngInitClipObj(XCLIPOBJ *Clip);
VOID FASTCALL
IntEngFreeClipResources(XCLIPOBJ *Clip);
BOOL FASTCALL BOOL FASTCALL

View file

@ -366,11 +366,12 @@ EngLineTo(
if (!Clip) if (!Clip)
{ {
Clip = pcoPriv = IntEngCreateClipRegion(0, 0, RectBounds); Clip = pcoPriv = EngCreateClip();
if (!Clip) if (!Clip)
{ {
return FALSE; return FALSE;
} }
IntEngUpdateClipRegion((XCLIPOBJ*)Clip, 0, 0, RectBounds);
} }
x1 += Translate.x; x1 += Translate.x;
@ -487,7 +488,7 @@ EngLineTo(
if (pcoPriv) if (pcoPriv)
{ {
IntEngDeleteClipRegion(pcoPriv); EngDeleteClip(pcoPriv);
} }
return IntEngLeave(&EnterLeave); return IntEngLeave(&EnterLeave);

View file

@ -8,7 +8,7 @@
*/ */
#define PUTPIXEL(x,y,BrushInst) \ #define PUTPIXEL(x,y,BrushInst) \
ret = ret && IntEngLineTo(&psurf->SurfObj, \ ret = ret && IntEngLineTo(&psurf->SurfObj, \
dc->rosdc.CombinedClip, \ &dc->co.ClipObj, \
&BrushInst.BrushObject, \ &BrushInst.BrushObject, \
x, y, (x)+1, y, \ x, y, (x)+1, y, \
&RectBounds, \ &RectBounds, \
@ -16,7 +16,7 @@
#define PUTLINE(x1,y1,x2,y2,BrushInst) \ #define PUTLINE(x1,y1,x2,y2,BrushInst) \
ret = ret && IntEngLineTo(&psurf->SurfObj, \ ret = ret && IntEngLineTo(&psurf->SurfObj, \
dc->rosdc.CombinedClip, \ &dc->co.ClipObj, \
&BrushInst.BrushObject, \ &BrushInst.BrushObject, \
x1, y1, x2, y2, \ x1, y1, x2, y2, \
&RectBounds, \ &RectBounds, \

View file

@ -131,7 +131,7 @@ NtGdiAlphaBlend(
TRACE("Performing the alpha blend\n"); TRACE("Performing the alpha blend\n");
bResult = IntEngAlphaBlend(&BitmapDest->SurfObj, bResult = IntEngAlphaBlend(&BitmapDest->SurfObj,
&BitmapSrc->SurfObj, &BitmapSrc->SurfObj,
DCDest->rosdc.CombinedClip, &DCDest->co.ClipObj,
&exlo.xlo, &exlo.xlo,
&DestRect, &DestRect,
&SourceRect, &SourceRect,
@ -290,7 +290,7 @@ NtGdiTransparentBlt(
EXLATEOBJ_vInitXlateFromDCs(&exlo, DCSrc, DCDest); EXLATEOBJ_vInitXlateFromDCs(&exlo, DCSrc, DCDest);
Ret = IntEngTransparentBlt(&BitmapDest->SurfObj, &BitmapSrc->SurfObj, Ret = IntEngTransparentBlt(&BitmapDest->SurfObj, &BitmapSrc->SurfObj,
DCDest->rosdc.CombinedClip, &exlo.xlo, &rcDest, &rcSrc, &DCDest->co.ClipObj, &exlo.xlo, &rcDest, &rcSrc,
TransparentColor, 0); TransparentColor, 0);
EXLATEOBJ_vCleanup(&exlo); EXLATEOBJ_vCleanup(&exlo);
@ -487,7 +487,7 @@ NtGdiMaskBlt(
Status = IntEngBitBlt(&BitmapDest->SurfObj, Status = IntEngBitBlt(&BitmapDest->SurfObj,
BitmapSrc ? &BitmapSrc->SurfObj : NULL, BitmapSrc ? &BitmapSrc->SurfObj : NULL,
psurfMask ? &psurfMask->SurfObj : NULL, psurfMask ? &psurfMask->SurfObj : NULL,
DCDest->rosdc.CombinedClip, &DCDest->co.ClipObj,
XlateObj, XlateObj,
&DestRect, &DestRect,
&SourcePoint, &SourcePoint,
@ -697,7 +697,7 @@ GreStretchBltMask(
Status = IntEngStretchBlt(&BitmapDest->SurfObj, Status = IntEngStretchBlt(&BitmapDest->SurfObj,
BitmapSrc ? &BitmapSrc->SurfObj : NULL, BitmapSrc ? &BitmapSrc->SurfObj : NULL,
BitmapMask ? &BitmapMask->SurfObj : NULL, BitmapMask ? &BitmapMask->SurfObj : NULL,
DCDest->rosdc.CombinedClip, &DCDest->co.ClipObj,
XlateObj, XlateObj,
&DCDest->dclevel.ca, &DCDest->dclevel.ca,
&DestRect, &DestRect,
@ -834,7 +834,7 @@ IntPatBlt(
&psurf->SurfObj, &psurf->SurfObj,
NULL, NULL,
NULL, NULL,
pdc->rosdc.CombinedClip, &pdc->co.ClipObj,
NULL, NULL,
&DestRect, &DestRect,
NULL, NULL,

View file

@ -467,8 +467,6 @@ VOID
FASTCALL FASTCALL
CLIPPING_UpdateGCRegion(PDC pDC) CLIPPING_UpdateGCRegion(PDC pDC)
{ {
CLIPOBJ * co;
/* Must have VisRgn set to a valid state! */ /* Must have VisRgn set to a valid state! */
ASSERT (pDC->prgnVis); ASSERT (pDC->prgnVis);
@ -540,16 +538,10 @@ CLIPPING_UpdateGCRegion(PDC pDC)
// With pDC->co.pClipRgn->Buffer, // With pDC->co.pClipRgn->Buffer,
// pDC->co.pClipRgn = pDC->prgnRao ? pDC->prgnRao : pDC->prgnVis; // pDC->co.pClipRgn = pDC->prgnRao ? pDC->prgnRao : pDC->prgnVis;
co = IntEngCreateClipRegion(pDC->prgnRao->rdh.nCount, IntEngUpdateClipRegion(&pDC->co,
pDC->prgnRao->rdh.nCount,
pDC->prgnRao->Buffer, pDC->prgnRao->Buffer,
&pDC->erclClip); &pDC->erclClip);
if (co)
{
if (pDC->rosdc.CombinedClip != NULL)
IntEngDeleteClipRegion(pDC->rosdc.CombinedClip);
pDC->rosdc.CombinedClip = co;
}
IntGdiOffsetRgn(pDC->prgnRao, -pDC->ptlDCOrig.x, -pDC->ptlDCOrig.y); IntGdiOffsetRgn(pDC->prgnRao, -pDC->ptlDCOrig.x, -pDC->ptlDCOrig.y);
} }

View file

@ -46,11 +46,6 @@ typedef enum _DCTYPE
/* Type definitions ***********************************************************/ /* Type definitions ***********************************************************/
typedef struct _ROS_DC_INFO
{
CLIPOBJ *CombinedClip;
} ROS_DC_INFO;
typedef struct _DCLEVEL typedef struct _DCLEVEL
{ {
HPALETTE hpal; HPALETTE hpal;
@ -136,9 +131,6 @@ typedef struct _DC
ULONG ulCopyCount; ULONG ulCopyCount;
PVOID pSurfInfo; PVOID pSurfInfo;
POINTL ptlDoBanding; POINTL ptlDoBanding;
/* Reactos specific members */
ROS_DC_INFO rosdc;
} DC; } DC;
extern PDC defaultDCstate; extern PDC defaultDCstate;

View file

@ -232,6 +232,9 @@ DC_vInitDc(
pdc->prgnVis = IntSysCreateRectpRgn(0, 0, pdc->dclevel.sizl.cx, pdc->dclevel.sizl.cy); pdc->prgnVis = IntSysCreateRectpRgn(0, 0, pdc->dclevel.sizl.cx, pdc->dclevel.sizl.cy);
ASSERT(pdc->prgnVis); ASSERT(pdc->prgnVis);
/* Initialize Clip object */
IntEngInitClipObj(&pdc->co);
/* Setup palette */ /* Setup palette */
pdc->dclevel.hpal = StockObjects[DEFAULT_PALETTE]; pdc->dclevel.hpal = StockObjects[DEFAULT_PALETTE];
pdc->dclevel.ppal = PALETTE_ShareLockPalette(pdc->dclevel.hpal); pdc->dclevel.ppal = PALETTE_ShareLockPalette(pdc->dclevel.hpal);
@ -373,8 +376,9 @@ DC_vCleanup(PVOID ObjectBody)
REGION_Delete(pdc->prgnRao); REGION_Delete(pdc->prgnRao);
if (pdc->prgnAPI) if (pdc->prgnAPI)
REGION_Delete(pdc->prgnAPI); REGION_Delete(pdc->prgnAPI);
if (pdc->rosdc.CombinedClip)
IntEngDeleteClipRegion(pdc->rosdc.CombinedClip); /* Free CLIPOBJ resources */
IntEngFreeClipResources(&pdc->co);
PATH_Delete(pdc->dclevel.hPath); PATH_Delete(pdc->dclevel.hPath);

View file

@ -530,7 +530,7 @@ NtGdiSetDIBitsToDeviceInternal(
Status = IntEngBitBlt(pDestSurf, Status = IntEngBitBlt(pDestSurf,
pSourceSurf, pSourceSurf,
NULL, NULL,
pDC->rosdc.CombinedClip, &pDC->co.ClipObj,
&exlo.xlo, &exlo.xlo,
&rcDest, &rcDest,
&ptSource, &ptSource,
@ -1200,7 +1200,7 @@ NtGdiStretchDIBitsInternal(
bResult = IntEngStretchBlt(&psurfDst->SurfObj, bResult = IntEngStretchBlt(&psurfDst->SurfObj,
&psurfTmp->SurfObj, &psurfTmp->SurfObj,
NULL, NULL,
pdc->rosdc.CombinedClip, &pdc->co.ClipObj,
&exlo.xlo, &exlo.xlo,
&pdc->dclevel.ca, &pdc->dclevel.ca,
&rcDst, &rcDst,

View file

@ -1295,7 +1295,7 @@ IntFillRect( DC *dc,
&psurf->SurfObj, &psurf->SurfObj,
NULL, NULL,
NULL, NULL,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
NULL, NULL,
&DestRect, &DestRect,
NULL, NULL,

View file

@ -112,7 +112,7 @@ IntGdiPolygon(PDC dc,
// Points[1].x, Points[1].y ); // Points[1].x, Points[1].y );
ret = IntEngLineTo(&psurf->SurfObj, ret = IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
&dc->eboLine.BrushObject, &dc->eboLine.BrushObject,
Points[i].x, /* From */ Points[i].x, /* From */
Points[i].y, Points[i].y,
@ -126,7 +126,7 @@ IntGdiPolygon(PDC dc,
if (ret) if (ret)
{ {
ret = IntEngLineTo(&psurf->SurfObj, ret = IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
&dc->eboLine.BrushObject, &dc->eboLine.BrushObject,
Points[Count-1].x, /* From */ Points[Count-1].x, /* From */
Points[Count-1].y, Points[Count-1].y,
@ -599,7 +599,7 @@ IntRectangle(PDC dc,
ret = IntEngBitBlt(&psurf->SurfObj, ret = IntEngBitBlt(&psurf->SurfObj,
NULL, NULL,
NULL, NULL,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
NULL, NULL,
&DestRect, &DestRect,
NULL, NULL,
@ -618,28 +618,28 @@ IntRectangle(PDC dc,
{ {
Mix = ROP2_TO_MIX(pdcattr->jROP2); Mix = ROP2_TO_MIX(pdcattr->jROP2);
ret = ret && IntEngLineTo(&psurf->SurfObj, ret = ret && IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
&dc->eboLine.BrushObject, &dc->eboLine.BrushObject,
DestRect.left, DestRect.top, DestRect.right, DestRect.top, DestRect.left, DestRect.top, DestRect.right, DestRect.top,
&DestRect, // Bounding rectangle &DestRect, // Bounding rectangle
Mix); Mix);
ret = ret && IntEngLineTo(&psurf->SurfObj, ret = ret && IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
&dc->eboLine.BrushObject, &dc->eboLine.BrushObject,
DestRect.right, DestRect.top, DestRect.right, DestRect.bottom, DestRect.right, DestRect.top, DestRect.right, DestRect.bottom,
&DestRect, // Bounding rectangle &DestRect, // Bounding rectangle
Mix); Mix);
ret = ret && IntEngLineTo(&psurf->SurfObj, ret = ret && IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
&dc->eboLine.BrushObject, &dc->eboLine.BrushObject,
DestRect.right, DestRect.bottom, DestRect.left, DestRect.bottom, DestRect.right, DestRect.bottom, DestRect.left, DestRect.bottom,
&DestRect, // Bounding rectangle &DestRect, // Bounding rectangle
Mix); Mix);
ret = ret && IntEngLineTo(&psurf->SurfObj, ret = ret && IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
&dc->eboLine.BrushObject, &dc->eboLine.BrushObject,
DestRect.left, DestRect.bottom, DestRect.left, DestRect.top, DestRect.left, DestRect.bottom, DestRect.left, DestRect.top,
&DestRect, // Bounding rectangle &DestRect, // Bounding rectangle
@ -963,10 +963,8 @@ GreGradientFill(
DC_vPrepareDCsForBlit(pdc, &rclExtent, NULL, NULL); DC_vPrepareDCsForBlit(pdc, &rclExtent, NULL, NULL);
ASSERT(pdc->rosdc.CombinedClip);
bRet = IntEngGradientFill(&psurf->SurfObj, bRet = IntEngGradientFill(&psurf->SurfObj,
pdc->rosdc.CombinedClip, &pdc->co.ClipObj,
&exlo.xlo, &exlo.xlo,
pVertex, pVertex,
nVertex, nVertex,

View file

@ -3317,7 +3317,7 @@ GreExtTextOutW(
&dc->dclevel.pSurface->SurfObj, &dc->dclevel.pSurface->SurfObj,
NULL, NULL,
NULL, NULL,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
NULL, NULL,
&DestRect, &DestRect,
&SourcePoint, &SourcePoint,
@ -3577,7 +3577,7 @@ GreExtTextOutW(
&psurf->SurfObj, &psurf->SurfObj,
NULL, NULL,
NULL, NULL,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
NULL, NULL,
&DestRect, &DestRect,
&SourcePoint, &SourcePoint,
@ -3650,7 +3650,7 @@ GreExtTextOutW(
IntEngMaskBlt( IntEngMaskBlt(
SurfObj, SurfObj,
SourceGlyphSurf, SourceGlyphSurf,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
&exloRGB2Dst.xlo, &exloRGB2Dst.xlo,
&exloDst2RGB.xlo, &exloDst2RGB.xlo,
&DestRect, &DestRect,

View file

@ -149,7 +149,7 @@ IntGdiLineTo(DC *dc,
if (!(pbrLine->flAttrs & BR_IS_NULL)) if (!(pbrLine->flAttrs & BR_IS_NULL))
{ {
Ret = IntEngLineTo(&psurf->SurfObj, Ret = IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
&dc->eboLine.BrushObject, &dc->eboLine.BrushObject,
Points[0].x, Points[0].y, Points[0].x, Points[0].y,
Points[1].x, Points[1].y, Points[1].x, Points[1].y,
@ -285,7 +285,7 @@ IntGdiPolyline(DC *dc,
} }
Ret = IntEngPolyline(&psurf->SurfObj, Ret = IntEngPolyline(&psurf->SurfObj,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
&dc->eboLine.BrushObject, &dc->eboLine.BrushObject,
Points, Points,
Count, Count,

View file

@ -408,7 +408,7 @@ POLYGONFILL_FillScanLineAlternate(
//DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); //DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine);
IntEngLineTo(&psurf->SurfObj, IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
BrushObj, BrushObj,
x1, x1,
ScanLine, ScanLine,
@ -481,7 +481,7 @@ POLYGONFILL_FillScanLineWinding(
//DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); //DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine);
IntEngLineTo(&psurf->SurfObj, IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
BrushObj, BrushObj,
x1, x1,
ScanLine, ScanLine,
@ -504,7 +504,7 @@ POLYGONFILL_FillScanLineWinding(
//DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); //DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine);
IntEngLineTo(&psurf->SurfObj, IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
BrushObj, BrushObj,
x1, x1,
ScanLine, ScanLine,
@ -627,7 +627,7 @@ IntFillPolygon(
IntEngBitBlt(&psurf->SurfObj, IntEngBitBlt(&psurf->SurfObj,
NULL, NULL,
NULL, NULL,
dc->rosdc.CombinedClip, &dc->co.ClipObj,
NULL, NULL,
&LineRect, &LineRect,
NULL, NULL,

View file

@ -2484,7 +2484,7 @@ IntGdiPaintRgn(
{ {
HRGN tmpVisRgn; HRGN tmpVisRgn;
PROSRGNDATA visrgn; PROSRGNDATA visrgn;
CLIPOBJ* ClipRegion; XCLIPOBJ ClipRegion;
BOOL bRet = FALSE; BOOL bRet = FALSE;
POINTL BrushOrigin; POINTL BrushOrigin;
SURFACE *psurf; SURFACE *psurf;
@ -2515,10 +2515,8 @@ IntGdiPaintRgn(
if (dc->prgnRao) if (dc->prgnRao)
IntGdiCombineRgn(visrgn, visrgn, dc->prgnRao, RGN_AND); IntGdiCombineRgn(visrgn, visrgn, dc->prgnRao, RGN_AND);
ClipRegion = IntEngCreateClipRegion(visrgn->rdh.nCount, IntEngInitClipObj(&ClipRegion);
visrgn->Buffer, IntEngUpdateClipRegion(&ClipRegion, visrgn->rdh.nCount, visrgn->Buffer, &visrgn->rdh.rcBound );
&visrgn->rdh.rcBound );
ASSERT(ClipRegion);
BrushOrigin.x = pdcattr->ptlBrushOrigin.x; BrushOrigin.x = pdcattr->ptlBrushOrigin.x;
BrushOrigin.y = pdcattr->ptlBrushOrigin.y; BrushOrigin.y = pdcattr->ptlBrushOrigin.y;
@ -2526,13 +2524,14 @@ IntGdiPaintRgn(
/* FIXME: Handle psurf == NULL !!!! */ /* FIXME: Handle psurf == NULL !!!! */
bRet = IntEngPaint(&psurf->SurfObj, bRet = IntEngPaint(&psurf->SurfObj,
ClipRegion, &ClipRegion.ClipObj,
&dc->eboFill.BrushObject, &dc->eboFill.BrushObject,
&BrushOrigin, &BrushOrigin,
0xFFFF); // FIXME: Don't know what to put here 0xFFFF); // FIXME: Don't know what to put here
RGNOBJAPI_Unlock(visrgn); RGNOBJAPI_Unlock(visrgn);
GreDeleteObject(tmpVisRgn); GreDeleteObject(tmpVisRgn);
IntEngFreeClipResources(&ClipRegion);
// Fill the region // Fill the region
return bRet; return bRet;

View file

@ -121,6 +121,8 @@ NtGdiSetPixelFormat(
SURFOBJ *pso = NULL; SURFOBJ *pso = NULL;
BOOL Ret = FALSE; BOOL Ret = FALSE;
DPRINT1("Setting pixel format from win32k!\n");
pdc = DC_LockDc(hdc); pdc = DC_LockDc(hdc);
if (!pdc) if (!pdc)
{ {

View file

@ -1290,7 +1290,7 @@ UserDrawIconEx(
DC_vPrepareDCsForBlit(pdc, &rcDest, NULL, NULL); DC_vPrepareDCsForBlit(pdc, &rcDest, NULL, NULL);
/* Get the clip object */ /* Get the clip object */
pdcClipObj = pdc->rosdc.CombinedClip; pdcClipObj = &pdc->co.ClipObj;
/* We now have our destination surface and rectangle */ /* We now have our destination surface and rectangle */
psurfDest = pdc->dclevel.pSurface; psurfDest = pdc->dclevel.pSurface;
@ -1475,7 +1475,7 @@ done:
DC_vPrepareDCsForBlit(pdc, &rcDest, NULL, NULL); DC_vPrepareDCsForBlit(pdc, &rcDest, NULL, NULL);
/* Get the clip object */ /* Get the clip object */
pdcClipObj = pdc->rosdc.CombinedClip; pdcClipObj = &pdc->co.ClipObj;
/* We now have our destination surface and rectangle */ /* We now have our destination surface and rectangle */
psurfDest = pdc->dclevel.pSurface; psurfDest = pdc->dclevel.pSurface;

View file

@ -1015,22 +1015,22 @@ UserGetWindowDC(PWND Wnd)
HWND FASTCALL HWND FASTCALL
UserGethWnd( HDC hdc, PWNDOBJ *pwndo) UserGethWnd( HDC hdc, PWNDOBJ *pwndo)
{ {
PWNDGDI pWndgdi; XCLIPOBJ* Clip;
PWND Wnd; PWND Wnd;
HWND hWnd; HWND hWnd;
PPROPERTY pprop; PPROPERTY pprop;
hWnd = IntWindowFromDC(hdc); hWnd = IntWindowFromDC(hdc);
if (hWnd && !(Wnd = UserGetWindowObject(hWnd))) if (hWnd && (Wnd = UserGetWindowObject(hWnd)))
{ {
pprop = IntGetProp(Wnd, AtomWndObj); pprop = IntGetProp(Wnd, AtomWndObj);
pWndgdi = (WNDGDI *)pprop->Data; Clip = (XCLIPOBJ*)pprop->Data;
if ( pWndgdi && pWndgdi->Hwnd == hWnd ) if ( Clip && Clip->Hwnd == hWnd )
{ {
if (pwndo) *pwndo = (PWNDOBJ)pWndgdi; if (pwndo) *pwndo = &Clip->WndObj;
} }
} }
return hWnd; return hWnd;