Author: jgardou Date: Sat Jul 26 15:41:08 2014 New Revision: 63739
URL: http://svn.reactos.org/svn/reactos?rev=63739&view=rev Log: [WIN32K] - 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.
Modified: trunk/reactos/win32ss/gdi/eng/bitblt.c trunk/reactos/win32ss/gdi/eng/clip.c trunk/reactos/win32ss/gdi/eng/engobjects.h trunk/reactos/win32ss/gdi/eng/engwindow.c trunk/reactos/win32ss/gdi/eng/inteng.h trunk/reactos/win32ss/gdi/eng/lineto.c trunk/reactos/win32ss/gdi/ntgdi/arc.c trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c trunk/reactos/win32ss/gdi/ntgdi/dc.h trunk/reactos/win32ss/gdi/ntgdi/dclife.c trunk/reactos/win32ss/gdi/ntgdi/dibobj.c trunk/reactos/win32ss/gdi/ntgdi/drawing.c trunk/reactos/win32ss/gdi/ntgdi/fillshap.c trunk/reactos/win32ss/gdi/ntgdi/freetype.c trunk/reactos/win32ss/gdi/ntgdi/line.c trunk/reactos/win32ss/gdi/ntgdi/polyfill.c trunk/reactos/win32ss/gdi/ntgdi/region.c trunk/reactos/win32ss/gdi/ntgdi/wingl.c trunk/reactos/win32ss/user/ntuser/cursoricon.c trunk/reactos/win32ss/user/ntuser/windc.c
Modified: trunk/reactos/win32ss/gdi/eng/bitblt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/bitblt.c?re... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/bitblt.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -14,7 +14,17 @@
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 };
Modified: trunk/reactos/win32ss/gdi/eng/clip.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/clip.c?rev=... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/clip.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/clip.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -190,63 +190,63 @@
VOID FASTCALL -IntEngDeleteClipRegion(CLIPOBJ *ClipObj) -{ - EngFreeMem(ObjToGDI(ClipObj, CLIP)); -} - -CLIPOBJ* +IntEngInitClipObj(XCLIPOBJ *Clip) +{ + Clip->Rects = &Clip->ClipObj.rclBounds; +} + +VOID FASTCALL +IntEngFreeClipResources(XCLIPOBJ *Clip) +{ + if (Clip->Rects != &Clip->ClipObj.rclBounds) + EngFreeMem(Clip->Rects); +} + + +VOID FASTCALL -IntEngCreateClipRegion(ULONG count, PRECTL pRect, PRECTL rcBounds) -{ - CLIPGDI *Clip; - +IntEngUpdateClipRegion( + XCLIPOBJ* Clip, + ULONG count, + const RECTL* pRect, + const RECTL* rcBounds) +{ if(count > 1) { - RECTL *dest; - - Clip = EngAllocMem(0, sizeof(CLIPGDI) + ((count - 1) * sizeof(RECTL)), GDITAG_CLIPOBJ); - - if(Clip != NULL) - { - Clip->EnumRects.c = count; + RECTL* NewRects = EngAllocMem(0, FIELD_OFFSET(ENUMRECTS, arcl[count]), GDITAG_CLIPOBJ); + + if(NewRects != NULL) + { + Clip->RectCount = count; Clip->EnumOrder = CD_ANY; - for(dest = Clip->EnumRects.arcl;count > 0; count--, dest++, pRect++) - { - *dest = *pRect; - } + RtlCopyMemory(NewRects, pRect, count * sizeof(RECTL));
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.rclBounds = *rcBounds;
- return GDIToObj(Clip, CLIP); - } - } - else - { - Clip = EngAllocMem(0, sizeof(CLIPGDI), GDITAG_CLIPOBJ); - - if(Clip != NULL) - { - Clip->EnumRects.c = 1; - Clip->EnumOrder = CD_ANY; - Clip->EnumRects.arcl[0] = *rcBounds; - - Clip->ClipObj.iDComplexity = (((rcBounds->top == rcBounds->bottom) && - (rcBounds->left == rcBounds->right)) - ? DC_TRIVIAL : DC_RECT); - - Clip->ClipObj.iFComplexity = FC_RECT; - Clip->ClipObj.iMode = TC_RECTANGLES; - Clip->ClipObj.rclBounds = *rcBounds; - - return GDIToObj(Clip, CLIP); - } - } - - return NULL; + if (Clip->Rects != &Clip->ClipObj.rclBounds) + EngFreeMem(Clip->Rects); + Clip->Rects = NewRects; + } + } + else + { + Clip->EnumOrder = CD_ANY; + + Clip->ClipObj.iDComplexity = (((rcBounds->top == rcBounds->bottom) && + (rcBounds->left == rcBounds->right)) + ? DC_TRIVIAL : DC_RECT); + + Clip->ClipObj.iFComplexity = FC_RECT; + Clip->ClipObj.iMode = TC_RECTANGLES; + Clip->ClipObj.rclBounds = *rcBounds; + Clip->RectCount = 1; + if (Clip->Rects != &Clip->ClipObj.rclBounds) + EngFreeMem(Clip->Rects); + Clip->Rects = &Clip->ClipObj.rclBounds; + } }
/* @@ -259,7 +259,8 @@ CLIPGDI *Clip = EngAllocMem(FL_ZERO_MEMORY, sizeof(CLIPGDI), GDITAG_CLIPOBJ); if(Clip != NULL) { - return GDIToObj(Clip, CLIP); + Clip->Rects = &Clip->ClipObj.rclBounds; + return &Clip->ClipObj; }
return NULL; @@ -273,7 +274,10 @@ EngDeleteClip( _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 @@ _In_ ULONG iDirection, _In_ ULONG cMaxRects) { - CLIPGDI *ClipGDI = ObjToGDI(pco, CLIP); + XCLIPOBJ* Clip = CONTAINING_RECORD(pco, XCLIPOBJ, ClipObj); SORTCOMP CompareFunc;
- ClipGDI->EnumPos = 0; - ClipGDI->EnumMax = (cMaxRects > 0) ? cMaxRects : ClipGDI->EnumRects.c; - - if (CD_ANY != iDirection && ClipGDI->EnumOrder != iDirection) + Clip->EnumPos = 0; + Clip->EnumMax = (cMaxRects > 0) ? cMaxRects : Clip->RectCount; + + if (CD_ANY != iDirection && Clip->EnumOrder != iDirection) { switch (iDirection) { @@ -316,26 +320,26 @@
default: DPRINT1("Invalid iDirection %lu\n", iDirection); - iDirection = ClipGDI->EnumOrder; + iDirection = Clip->EnumOrder; CompareFunc = NULL; break; }
if (NULL != CompareFunc) { - EngSort((PBYTE) ClipGDI->EnumRects.arcl, sizeof(RECTL), ClipGDI->EnumRects.c, CompareFunc); - } - - ClipGDI->EnumOrder = iDirection; + EngSort((PBYTE) Clip->Rects, sizeof(RECTL), Clip->RectCount, CompareFunc); + } + + Clip->EnumOrder = iDirection; }
/* Return the number of rectangles enumerated */ - if ((cMaxRects > 0) && (ClipGDI->EnumRects.c > cMaxRects)) + if ((cMaxRects > 0) && (Clip->RectCount > cMaxRects)) { return 0xFFFFFFFF; }
- return ClipGDI->EnumRects.c; + return Clip->RectCount; }
/* @@ -348,14 +352,14 @@ _In_ ULONG cj, _Out_bytecap_(cj) ULONG *pulEnumRects) { - RECTL *dest, *src; - CLIPGDI *ClipGDI = ObjToGDI(pco, CLIP); - ULONG nCopy, i; + const RECTL* src; + XCLIPOBJ* Clip = CONTAINING_RECORD(pco, XCLIPOBJ, ClipObj); + ULONG nCopy; ENUMRECTS* pERects = (ENUMRECTS*)pulEnumRects;
// Calculate how many rectangles we should copy - nCopy = min( ClipGDI->EnumMax - ClipGDI->EnumPos, - min( ClipGDI->EnumRects.c - ClipGDI->EnumPos, + nCopy = min( Clip->EnumMax - Clip->EnumPos, + min( Clip->RectCount - Clip->EnumPos, (cj - sizeof(ULONG)) / sizeof(RECTL)));
if(nCopy == 0) @@ -364,17 +368,14 @@ }
/* Copy rectangles */ - src = ClipGDI->EnumRects.arcl + ClipGDI->EnumPos; - for(i = 0, dest = pERects->arcl; i < nCopy; i++, dest++, src++) - { - *dest = *src; - } + src = &Clip->Rects[Clip->EnumPos]; + RtlCopyMemory(pERects->arcl, src, nCopy * sizeof(RECTL));
pERects->c = nCopy;
- ClipGDI->EnumPos+=nCopy; - - return ClipGDI->EnumPos < ClipGDI->EnumRects.c; + Clip->EnumPos+=nCopy; + + return Clip->EnumPos < Clip->RectCount; }
/* EOF */
Modified: trunk/reactos/win32ss/gdi/eng/engobjects.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/engobjects.... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/engobjects.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/engobjects.h [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -68,11 +68,22 @@ } */ typedef struct _CLIPGDI { - CLIPOBJ ClipObj; - ULONG EnumPos; - ULONG EnumOrder; - ULONG EnumMax; - ENUMRECTS EnumRects; + union + { + CLIPOBJ ClipObj; + WNDOBJ WndObj; + }; + /* WNDOBJ part */ + HWND Hwnd; + WNDOBJCHANGEPROC ChangeProc; + FLONG Flags; + int PixelFormat; + /* CLIPOBJ part */ + ULONG EnumPos; + ULONG EnumOrder; + ULONG EnumMax; + ULONG RectCount; + RECTL* Rects; } CLIPGDI, *PCLIPGDI;
// HACK, until we use the original structure @@ -112,15 +123,6 @@ PATHOBJ PathObj; } PATHGDI;
-typedef struct _WNDGDI { - WNDOBJ WndObj; - HWND Hwnd; - CLIPOBJ *ClientClipObj; - WNDOBJCHANGEPROC ChangeProc; - FLONG Flags; - int PixelFormat; -} WNDGDI, *PWNDGDI; - typedef struct _XFORMGDI { ULONG Dummy; /* XFORMOBJ has no public members */
Modified: trunk/reactos/win32ss/gdi/eng/engwindow.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/engwindow.c... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/engwindow.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/engwindow.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -21,15 +21,15 @@ IN WNDOBJ *pwo, IN FLONG flChanged) { - WNDGDI *WndObjInt = ObjToGDI(pwo, WND); - - if (WndObjInt->ChangeProc == NULL) + XCLIPOBJ* Clip = CONTAINING_RECORD(pwo, XCLIPOBJ, WndObj); + + if (Clip->ChangeProc == NULL) { return; }
/* check flags of the WNDOBJ */ - flChanged &= WndObjInt->Flags; + flChanged &= Clip->Flags; if (flChanged == 0) { return; @@ -42,8 +42,8 @@ }
TRACE("Calling WNDOBJCHANGEPROC (0x%p), Changed = 0x%x\n", - WndObjInt->ChangeProc, flChanged); - WndObjInt->ChangeProc(pwo, flChanged); + Clip->ChangeProc, flChanged); + Clip->ChangeProc(pwo, flChanged); }
/* @@ -52,13 +52,11 @@ BOOLEAN FASTCALL IntEngWndUpdateClipObj( - WNDGDI *WndObjInt, + XCLIPOBJ* Clip, PWND Window) { HRGN hVisRgn; PROSRGNDATA visRgn; - CLIPOBJ *ClipObj = NULL; - CLIPOBJ *OldClipObj;
TRACE("IntEngWndUpdateClipObj\n");
@@ -70,8 +68,7 @@ { if (visRgn->rdh.nCount > 0) { - ClipObj = IntEngCreateClipRegion(visRgn->rdh.nCount, visRgn->Buffer, - &visRgn->rdh.rcBound); + IntEngUpdateClipRegion(Clip, visRgn->rdh.nCount, visRgn->Buffer, &visRgn->rdh.rcBound); TRACE("Created visible region with %lu rects\n", visRgn->rdh.nCount); TRACE(" BoundingRect: %d, %d %d, %d\n", visRgn->rdh.rcBound.left, visRgn->rdh.rcBound.top, @@ -96,27 +93,12 @@ } else { - WARN("VIS_ComputeVisibleRegion failed!\n"); - } - - if (ClipObj == NULL) - { /* Fall back to client rect */ - ClipObj = IntEngCreateClipRegion(1, &Window->rcClient, - &Window->rcClient); - } - - if (ClipObj == NULL) - { - 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); + IntEngUpdateClipRegion(Clip, 1, &Window->rcClient, &Window->rcClient); + } + + /* Update the WNDOBJ */ + Clip->WndObj.rclClient = Window->rcClient;
return TRUE; } @@ -131,7 +113,7 @@ _In_ FLONG flChanged) { PPROPERTY pprop; - WNDGDI *Current; + XCLIPOBJ *Current; HWND hWnd;
ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL); @@ -142,7 +124,7 @@ { return; } - Current = (WNDGDI *)pprop->Data; + Current = (XCLIPOBJ *)pprop->Data; if ( gcountPWO && Current && Current->Hwnd == hWnd && @@ -184,7 +166,7 @@ FLONG fl, int iPixelFormat) { - WNDGDI *WndObjInt = NULL; + XCLIPOBJ *Clip = NULL; WNDOBJ *WndObjUser = NULL; PWND Window; BOOL calledFromUser; @@ -206,34 +188,34 @@ }
/* Create WNDOBJ */ - WndObjInt = EngAllocMem(0, sizeof (WNDGDI), GDITAG_WNDOBJ); - if (WndObjInt == NULL) + Clip = EngAllocMem(FL_ZERO_MEMORY, sizeof (XCLIPOBJ), GDITAG_WNDOBJ); + if (Clip == NULL) { ERR("Failed to allocate memory for a WND structure!\n"); RETURN( NULL); } + IntEngInitClipObj(Clip);
/* Fill the clipobj */ - WndObjInt->ClientClipObj = NULL; - if (!IntEngWndUpdateClipObj(WndObjInt, Window)) - { - EngFreeMem(WndObjInt); + if (!IntEngWndUpdateClipObj(Clip, Window)) + { + EngFreeMem(Clip); RETURN( NULL); }
/* Fill user object */ - WndObjUser = GDIToObj(WndObjInt, WND); + WndObjUser = &Clip->WndObj; WndObjUser->psoOwner = pso; WndObjUser->pvConsumer = NULL;
/* Fill internal object */ - WndObjInt->Hwnd = hWnd; - WndObjInt->ChangeProc = pfn; - WndObjInt->Flags = fl; - WndObjInt->PixelFormat = iPixelFormat; + Clip->Hwnd = hWnd; + Clip->ChangeProc = pfn; + Clip->Flags = fl; + Clip->PixelFormat = iPixelFormat;
/* associate object with window */ - IntSetProp(Window, AtomWndObj, WndObjInt); + IntSetProp(Window, AtomWndObj, Clip); ++gcountPWO;
TRACE("EngCreateWnd: SUCCESS!\n"); @@ -258,7 +240,7 @@ EngDeleteWnd( IN WNDOBJ *pwo) { - WNDGDI *WndObjInt = ObjToGDI(pwo, WND); + XCLIPOBJ* Clip = CONTAINING_RECORD(pwo, XCLIPOBJ, WndObj); PWND Window; BOOL calledFromUser;
@@ -270,7 +252,7 @@ }
/* Get window object */ - Window = UserGetWindowObject(WndObjInt->Hwnd); + Window = UserGetWindowObject(Clip->Hwnd); if (Window == NULL) { ERR("Couldnt get window object for WndObjInt->Hwnd!!!\n"); @@ -287,8 +269,8 @@ }
/* Free resources */ - IntEngDeleteClipRegion(WndObjInt->ClientClipObj); - EngFreeMem(WndObjInt); + IntEngFreeClipResources(Clip); + EngFreeMem(Clip); }
@@ -302,14 +284,8 @@ IN ULONG cj, OUT ULONG *pul) { - WNDGDI *WndObjInt = ObjToGDI(pwo, WND); - BOOL Ret; - - 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; + /* Relay */ + return CLIPOBJ_bEnum(&pwo->coClient, cj, pul); }
@@ -324,17 +300,9 @@ IN ULONG iDirection, IN ULONG cLimit) { - WNDGDI *WndObjInt = ObjToGDI(pwo, WND); - ULONG Ret; - - 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; + /* Relay */ + // FIXME: Should we enumerate all rectangles or not? + return CLIPOBJ_cEnumStart(&pwo->coClient, FALSE, iType, iDirection, cLimit); }
Modified: trunk/reactos/win32ss/gdi/eng/inteng.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/inteng.h?re... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/inteng.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/inteng.h [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -114,13 +114,17 @@ LONG dCount, MIX mix);
-CLIPOBJ* FASTCALL -IntEngCreateClipRegion(ULONG count, - PRECTL pRect, - PRECTL rcBounds); +VOID FASTCALL +IntEngUpdateClipRegion(XCLIPOBJ* Clip, + ULONG count, + const RECTL* pRect, + const RECTL* rcBounds);
VOID FASTCALL -IntEngDeleteClipRegion(CLIPOBJ *ClipObj); +IntEngInitClipObj(XCLIPOBJ *Clip); + +VOID FASTCALL +IntEngFreeClipResources(XCLIPOBJ *Clip);
BOOL FASTCALL
Modified: trunk/reactos/win32ss/gdi/eng/lineto.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/lineto.c?re... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/lineto.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/lineto.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -366,11 +366,12 @@
if (!Clip) { - Clip = pcoPriv = IntEngCreateClipRegion(0, 0, RectBounds); + Clip = pcoPriv = EngCreateClip(); if (!Clip) { return FALSE; } + IntEngUpdateClipRegion((XCLIPOBJ*)Clip, 0, 0, RectBounds); }
x1 += Translate.x; @@ -487,7 +488,7 @@
if (pcoPriv) { - IntEngDeleteClipRegion(pcoPriv); + EngDeleteClip(pcoPriv); }
return IntEngLeave(&EnterLeave);
Modified: trunk/reactos/win32ss/gdi/ntgdi/arc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/arc.c?rev... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/arc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/arc.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -8,7 +8,7 @@ */ #define PUTPIXEL(x,y,BrushInst) \ ret = ret && IntEngLineTo(&psurf->SurfObj, \ - dc->rosdc.CombinedClip, \ + &dc->co.ClipObj, \ &BrushInst.BrushObject, \ x, y, (x)+1, y, \ &RectBounds, \ @@ -16,7 +16,7 @@
#define PUTLINE(x1,y1,x2,y2,BrushInst) \ ret = ret && IntEngLineTo(&psurf->SurfObj, \ - dc->rosdc.CombinedClip, \ + &dc->co.ClipObj, \ &BrushInst.BrushObject, \ x1, y1, x2, y2, \ &RectBounds, \
Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c?... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -131,7 +131,7 @@ TRACE("Performing the alpha blend\n"); bResult = IntEngAlphaBlend(&BitmapDest->SurfObj, &BitmapSrc->SurfObj, - DCDest->rosdc.CombinedClip, + &DCDest->co.ClipObj, &exlo.xlo, &DestRect, &SourceRect, @@ -290,7 +290,7 @@ EXLATEOBJ_vInitXlateFromDCs(&exlo, DCSrc, DCDest);
Ret = IntEngTransparentBlt(&BitmapDest->SurfObj, &BitmapSrc->SurfObj, - DCDest->rosdc.CombinedClip, &exlo.xlo, &rcDest, &rcSrc, + &DCDest->co.ClipObj, &exlo.xlo, &rcDest, &rcSrc, TransparentColor, 0);
EXLATEOBJ_vCleanup(&exlo); @@ -487,7 +487,7 @@ Status = IntEngBitBlt(&BitmapDest->SurfObj, BitmapSrc ? &BitmapSrc->SurfObj : NULL, psurfMask ? &psurfMask->SurfObj : NULL, - DCDest->rosdc.CombinedClip, + &DCDest->co.ClipObj, XlateObj, &DestRect, &SourcePoint, @@ -697,7 +697,7 @@ Status = IntEngStretchBlt(&BitmapDest->SurfObj, BitmapSrc ? &BitmapSrc->SurfObj : NULL, BitmapMask ? &BitmapMask->SurfObj : NULL, - DCDest->rosdc.CombinedClip, + &DCDest->co.ClipObj, XlateObj, &DCDest->dclevel.ca, &DestRect, @@ -834,7 +834,7 @@ &psurf->SurfObj, NULL, NULL, - pdc->rosdc.CombinedClip, + &pdc->co.ClipObj, NULL, &DestRect, NULL,
Modified: trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -467,8 +467,6 @@ FASTCALL CLIPPING_UpdateGCRegion(PDC pDC) { - CLIPOBJ * co; - /* Must have VisRgn set to a valid state! */ ASSERT (pDC->prgnVis);
@@ -540,16 +538,10 @@ // With pDC->co.pClipRgn->Buffer, // pDC->co.pClipRgn = pDC->prgnRao ? pDC->prgnRao : pDC->prgnVis;
- co = IntEngCreateClipRegion(pDC->prgnRao->rdh.nCount, - pDC->prgnRao->Buffer, - &pDC->erclClip); - if (co) - { - if (pDC->rosdc.CombinedClip != NULL) - IntEngDeleteClipRegion(pDC->rosdc.CombinedClip); - - pDC->rosdc.CombinedClip = co; - } + IntEngUpdateClipRegion(&pDC->co, + pDC->prgnRao->rdh.nCount, + pDC->prgnRao->Buffer, + &pDC->erclClip);
IntGdiOffsetRgn(pDC->prgnRao, -pDC->ptlDCOrig.x, -pDC->ptlDCOrig.y); }
Modified: trunk/reactos/win32ss/gdi/ntgdi/dc.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dc.h?rev=... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -45,11 +45,6 @@
/* Type definitions ***********************************************************/ - -typedef struct _ROS_DC_INFO -{ - CLIPOBJ *CombinedClip; -} ROS_DC_INFO;
typedef struct _DCLEVEL { @@ -136,9 +131,6 @@ ULONG ulCopyCount; PVOID pSurfInfo; POINTL ptlDoBanding; - - /* Reactos specific members */ - ROS_DC_INFO rosdc; } DC;
extern PDC defaultDCstate;
Modified: trunk/reactos/win32ss/gdi/ntgdi/dclife.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dclife.c?... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -232,6 +232,9 @@ pdc->prgnVis = IntSysCreateRectpRgn(0, 0, pdc->dclevel.sizl.cx, pdc->dclevel.sizl.cy); ASSERT(pdc->prgnVis);
+ /* Initialize Clip object */ + IntEngInitClipObj(&pdc->co); + /* Setup palette */ pdc->dclevel.hpal = StockObjects[DEFAULT_PALETTE]; pdc->dclevel.ppal = PALETTE_ShareLockPalette(pdc->dclevel.hpal); @@ -373,8 +376,9 @@ REGION_Delete(pdc->prgnRao); if (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);
Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c?... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -530,7 +530,7 @@ Status = IntEngBitBlt(pDestSurf, pSourceSurf, NULL, - pDC->rosdc.CombinedClip, + &pDC->co.ClipObj, &exlo.xlo, &rcDest, &ptSource, @@ -1200,7 +1200,7 @@ bResult = IntEngStretchBlt(&psurfDst->SurfObj, &psurfTmp->SurfObj, NULL, - pdc->rosdc.CombinedClip, + &pdc->co.ClipObj, &exlo.xlo, &pdc->dclevel.ca, &rcDst,
Modified: trunk/reactos/win32ss/gdi/ntgdi/drawing.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/drawing.c... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/drawing.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/drawing.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -1295,7 +1295,7 @@ &psurf->SurfObj, NULL, NULL, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, NULL, &DestRect, NULL,
Modified: trunk/reactos/win32ss/gdi/ntgdi/fillshap.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/fillshap.... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/fillshap.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/fillshap.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -112,7 +112,7 @@ // Points[1].x, Points[1].y );
ret = IntEngLineTo(&psurf->SurfObj, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, &dc->eboLine.BrushObject, Points[i].x, /* From */ Points[i].y, @@ -126,7 +126,7 @@ if (ret) { ret = IntEngLineTo(&psurf->SurfObj, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, &dc->eboLine.BrushObject, Points[Count-1].x, /* From */ Points[Count-1].y, @@ -599,7 +599,7 @@ ret = IntEngBitBlt(&psurf->SurfObj, NULL, NULL, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, NULL, &DestRect, NULL, @@ -618,28 +618,28 @@ { Mix = ROP2_TO_MIX(pdcattr->jROP2); ret = ret && IntEngLineTo(&psurf->SurfObj, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, &dc->eboLine.BrushObject, DestRect.left, DestRect.top, DestRect.right, DestRect.top, &DestRect, // Bounding rectangle Mix);
ret = ret && IntEngLineTo(&psurf->SurfObj, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, &dc->eboLine.BrushObject, DestRect.right, DestRect.top, DestRect.right, DestRect.bottom, &DestRect, // Bounding rectangle Mix);
ret = ret && IntEngLineTo(&psurf->SurfObj, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, &dc->eboLine.BrushObject, DestRect.right, DestRect.bottom, DestRect.left, DestRect.bottom, &DestRect, // Bounding rectangle Mix);
ret = ret && IntEngLineTo(&psurf->SurfObj, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, &dc->eboLine.BrushObject, DestRect.left, DestRect.bottom, DestRect.left, DestRect.top, &DestRect, // Bounding rectangle @@ -963,10 +963,8 @@
DC_vPrepareDCsForBlit(pdc, &rclExtent, NULL, NULL);
- ASSERT(pdc->rosdc.CombinedClip); - bRet = IntEngGradientFill(&psurf->SurfObj, - pdc->rosdc.CombinedClip, + &pdc->co.ClipObj, &exlo.xlo, pVertex, nVertex,
Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype.... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -3317,7 +3317,7 @@ &dc->dclevel.pSurface->SurfObj, NULL, NULL, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, NULL, &DestRect, &SourcePoint, @@ -3577,7 +3577,7 @@ &psurf->SurfObj, NULL, NULL, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, NULL, &DestRect, &SourcePoint, @@ -3650,7 +3650,7 @@ IntEngMaskBlt( SurfObj, SourceGlyphSurf, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, &exloRGB2Dst.xlo, &exloDst2RGB.xlo, &DestRect,
Modified: trunk/reactos/win32ss/gdi/ntgdi/line.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/line.c?re... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/line.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/line.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -149,7 +149,7 @@ if (!(pbrLine->flAttrs & BR_IS_NULL)) { Ret = IntEngLineTo(&psurf->SurfObj, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, &dc->eboLine.BrushObject, Points[0].x, Points[0].y, Points[1].x, Points[1].y, @@ -285,7 +285,7 @@ }
Ret = IntEngPolyline(&psurf->SurfObj, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, &dc->eboLine.BrushObject, Points, Count,
Modified: trunk/reactos/win32ss/gdi/ntgdi/polyfill.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/polyfill.... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/polyfill.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/polyfill.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -408,7 +408,7 @@
//DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); IntEngLineTo(&psurf->SurfObj, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, BrushObj, x1, ScanLine, @@ -481,7 +481,7 @@
//DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); IntEngLineTo(&psurf->SurfObj, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, BrushObj, x1, ScanLine, @@ -504,7 +504,7 @@
//DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); IntEngLineTo(&psurf->SurfObj, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, BrushObj, x1, ScanLine, @@ -627,7 +627,7 @@ IntEngBitBlt(&psurf->SurfObj, NULL, NULL, - dc->rosdc.CombinedClip, + &dc->co.ClipObj, NULL, &LineRect, NULL,
Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.c?... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -2484,7 +2484,7 @@ { HRGN tmpVisRgn; PROSRGNDATA visrgn; - CLIPOBJ* ClipRegion; + XCLIPOBJ ClipRegion; BOOL bRet = FALSE; POINTL BrushOrigin; SURFACE *psurf; @@ -2515,10 +2515,8 @@ if (dc->prgnRao) IntGdiCombineRgn(visrgn, visrgn, dc->prgnRao, RGN_AND);
- ClipRegion = IntEngCreateClipRegion(visrgn->rdh.nCount, - visrgn->Buffer, - &visrgn->rdh.rcBound ); - ASSERT(ClipRegion); + IntEngInitClipObj(&ClipRegion); + IntEngUpdateClipRegion(&ClipRegion, visrgn->rdh.nCount, visrgn->Buffer, &visrgn->rdh.rcBound );
BrushOrigin.x = pdcattr->ptlBrushOrigin.x; BrushOrigin.y = pdcattr->ptlBrushOrigin.y; @@ -2526,13 +2524,14 @@ /* FIXME: Handle psurf == NULL !!!! */
bRet = IntEngPaint(&psurf->SurfObj, - ClipRegion, + &ClipRegion.ClipObj, &dc->eboFill.BrushObject, &BrushOrigin, 0xFFFF); // FIXME: Don't know what to put here
RGNOBJAPI_Unlock(visrgn); GreDeleteObject(tmpVisRgn); + IntEngFreeClipResources(&ClipRegion);
// Fill the region return bRet;
Modified: trunk/reactos/win32ss/gdi/ntgdi/wingl.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/wingl.c?r... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/wingl.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/wingl.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -121,6 +121,8 @@ SURFOBJ *pso = NULL; BOOL Ret = FALSE;
+ DPRINT1("Setting pixel format from win32k!\n"); + pdc = DC_LockDc(hdc); if (!pdc) {
Modified: trunk/reactos/win32ss/user/ntuser/cursoricon.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/cursori... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/cursoricon.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/cursoricon.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -1290,7 +1290,7 @@ DC_vPrepareDCsForBlit(pdc, &rcDest, NULL, NULL);
/* Get the clip object */ - pdcClipObj = pdc->rosdc.CombinedClip; + pdcClipObj = &pdc->co.ClipObj;
/* We now have our destination surface and rectangle */ psurfDest = pdc->dclevel.pSurface; @@ -1475,7 +1475,7 @@ DC_vPrepareDCsForBlit(pdc, &rcDest, NULL, NULL);
/* Get the clip object */ - pdcClipObj = pdc->rosdc.CombinedClip; + pdcClipObj = &pdc->co.ClipObj;
/* We now have our destination surface and rectangle */ psurfDest = pdc->dclevel.pSurface;
Modified: trunk/reactos/win32ss/user/ntuser/windc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/windc.c... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/windc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/windc.c [iso-8859-1] Sat Jul 26 15:41:08 2014 @@ -1015,22 +1015,22 @@ HWND FASTCALL UserGethWnd( HDC hdc, PWNDOBJ *pwndo) { - PWNDGDI pWndgdi; + XCLIPOBJ* Clip; PWND Wnd; HWND hWnd; PPROPERTY pprop;
hWnd = IntWindowFromDC(hdc);
- if (hWnd && !(Wnd = UserGetWindowObject(hWnd))) + if (hWnd && (Wnd = UserGetWindowObject(hWnd))) { pprop = IntGetProp(Wnd, AtomWndObj);
- pWndgdi = (WNDGDI *)pprop->Data; - - if ( pWndgdi && pWndgdi->Hwnd == hWnd ) + Clip = (XCLIPOBJ*)pprop->Data; + + if ( Clip && Clip->Hwnd == hWnd ) { - if (pwndo) *pwndo = (PWNDOBJ)pWndgdi; + if (pwndo) *pwndo = &Clip->WndObj; } } return hWnd;