Author: jimtabor
Date: Mon Mar 28 00:17:21 2011
New Revision: 51179
URL:
http://svn.reactos.org/svn/reactos?rev=51179&view=rev
Log:
[GDI32|User32|Win32k]
- Fix ScrollDC ApiTest.
Modified:
trunk/reactos/dll/win32/gdi32/misc/misc.c
trunk/reactos/dll/win32/user32/windows/paint.c
trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
trunk/reactos/subsystems/win32/win32k/objects/region.c
Modified: trunk/reactos/dll/win32/gdi32/misc/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/misc.…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/misc/misc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/misc/misc.c [iso-8859-1] Mon Mar 28 00:17:21 2011
@@ -275,7 +275,7 @@
FASTCALL
hGetPEBHandle(HANDLECACHETYPE Type, COLORREF cr)
{
- int Number, Count, MaxNum, GdiType;
+ int Number, Offset, MaxNum, GdiType;
HANDLE Lock;
HGDIOBJ Handle = NULL;
@@ -289,19 +289,19 @@
if (Type == hctBrushHandle)
{
- Count = 0;
+ Offset = 0;
MaxNum = CACHE_BRUSH_ENTRIES;
GdiType = GDILoObjType_LO_BRUSH_TYPE;
}
else if (Type == hctPenHandle)
{
- Count = CACHE_BRUSH_ENTRIES;
+ Offset = CACHE_BRUSH_ENTRIES;
MaxNum = CACHE_PEN_ENTRIES;
GdiType = GDILoObjType_LO_PEN_TYPE;
}
else if (Type == hctRegionHandle)
{
- Count = CACHE_BRUSH_ENTRIES+CACHE_PEN_ENTRIES;
+ Offset = CACHE_BRUSH_ENTRIES+CACHE_PEN_ENTRIES;
MaxNum = CACHE_REGION_ENTRIES;
GdiType = GDILoObjType_LO_REGION_TYPE;
}
@@ -314,7 +314,7 @@
{
PBRUSH_ATTR pBrush_Attr;
HGDIOBJ *hPtr;
- hPtr = GdiHandleCache->Handle + Count;
+ hPtr = GdiHandleCache->Handle + Offset;
Handle = hPtr[Number - 1];
if (GdiGetHandleUserData( Handle, GdiType, (PVOID) &pBrush_Attr))
@@ -335,6 +335,10 @@
}
}
}
+ else
+ {
+ Handle = NULL;
+ }
}
(void)InterlockedExchangePointer((PVOID*)&GdiHandleCache->ulLock, Lock);
return Handle;
Modified: trunk/reactos/dll/win32/user32/windows/paint.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/p…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/paint.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/paint.c [iso-8859-1] Mon Mar 28 00:17:21 2011
@@ -107,19 +107,19 @@
pWnd = ValidateHwnd(Wnd);
if (!pWnd)
return FALSE;
-/*
+
if ( pWnd->hrgnUpdate ||
pWnd->state &
(WNDS_SENDERASEBACKGROUND|WNDS_SENDNCPAINT|WNDS_UPDATEDIRTY|WNDS_PAINTNOTPROCESSED))
- {*/
+ {
return NtUserGetUpdateRect(Wnd, Rect, Erase);
-/* }
+ }
if (Rect)
{ // Did the Rgn update? No! Back set and shutup!
Rect->left = Rect->right = Rect->top = Rect->bottom = 0;
}
return FALSE; // msdn: "If there is no update region, the return value is
zero."
-*/
+
}
@@ -144,14 +144,14 @@
pWnd = ValidateHwnd(hWnd);
if (!pWnd)
return ERROR;
-/*
+
if ( pWnd->hrgnUpdate ||
pWnd->state &
(WNDS_SENDERASEBACKGROUND|WNDS_SENDNCPAINT|WNDS_UPDATEDIRTY|WNDS_PAINTNOTPROCESSED))
- {*/
+ {
return NtUserGetUpdateRgn(hWnd, hRgn, bErase);
-/* }
+ }
SetRectRgn(hRgn, 0, 0, 0, 0);
- return NULLREGION;*/
+ return NULLREGION;
}
@@ -239,14 +239,14 @@
if (!pWnd)
return FALSE;
-/*
+
if ( pWnd->hrgnUpdate ||
pWnd->state & WNDS_INTERNALPAINT ||
pWnd->spwndChild )
- {*/
+ {
return NtUserCallHwndLock(hWnd, HWNDLOCK_ROUTINE_UPDATEWINDOW);
-/* }
- return TRUE;*/
+ }
+ return TRUE;
}
/*
@@ -286,7 +286,7 @@
if (!Ret)
return ERROR;
- if (pWnd->fnid != FNID_DESKTOP)
+ if (hWnd != GetDesktopWindow()) // pWnd->fnid != FNID_DESKTOP)
Ret = OffsetRgn(hRgn, -pWnd->rcWindow.left, -pWnd->rcWindow.top);
if (pWnd->ExStyle & WS_EX_LAYOUTRTL)
@@ -320,7 +320,7 @@
if (!Ret)
return ERROR;
- if (pWnd->fnid != FNID_DESKTOP)
+ if (hWnd != GetDesktopWindow()) // pWnd->fnid != FNID_DESKTOP)
OffsetRect(lprc, -pWnd->rcWindow.left, -pWnd->rcWindow.top);
if (pWnd->ExStyle & WS_EX_LAYOUTRTL)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] Mon Mar 28
00:17:21 2011
@@ -1248,6 +1248,7 @@
hrgnOwn = hrgnUpdate;
if (!NtGdiSetRectRgn(hrgnOwn, rcDst.left, rcDst.top, rcDst.right,
rcDst.bottom))
{
+ DC_UnlockDc(pDC);
return ERROR;
}
}
@@ -1265,8 +1266,8 @@
NtGdiOffsetRgn(hrgnTmp, dx, dy);
Result = NtGdiCombineRgn(hrgnOwn, hrgnOwn, hrgnTmp, RGN_DIFF);
- /* DO NOT Unlock DC while messing with prgnVis! */
- DC_UnlockDc(pDC);
+ /* DO NOT Unlock DC while messing with prgnVis! */
+ DC_UnlockDc(pDC);
REGION_FreeRgnByHandle(hrgnTmp);
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] Mon Mar 28
00:17:21 2011
@@ -2080,6 +2080,7 @@
{
Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, pRgn->BaseObject.hHmgr);
Entry->UserData = AllocateObjectAttr();
+ RtlZeroMemory(Entry->UserData, sizeof(RGN_ATTR));
}
return pRgn;
}
@@ -2090,6 +2091,7 @@
{
PGDI_TABLE_ENTRY Entry;
PRGN_ATTR pRgn_Attr;
+ BOOL Hit = FALSE;
PROSRGNDATA pRgn = NULL;
pRgn = REGION_LockRgn(hRgn);
@@ -2103,11 +2105,12 @@
{
_SEH2_TRY
{
- if ( !(pRgn_Attr->AttrFlags & ATTR_CACHED) &&
- pRgn_Attr->AttrFlags & (ATTR_RGN_VALID|ATTR_RGN_DIRTY) )
+ if ( !(pRgn_Attr->AttrFlags & ATTR_CACHED) )
{
- switch (pRgn_Attr->Flags)
+ if ( pRgn_Attr->AttrFlags & (ATTR_RGN_VALID|ATTR_RGN_DIRTY) )
{
+ switch (pRgn_Attr->Flags)
+ {
case NULLREGION:
EMPTY_REGION( pRgn );
break;
@@ -2119,15 +2122,25 @@
pRgn_Attr->Rect.right,
pRgn_Attr->Rect.bottom );
break;
+ }
+ pRgn_Attr->AttrFlags &= ~ATTR_RGN_DIRTY;
}
- pRgn_Attr->AttrFlags &= ~ATTR_RGN_DIRTY;
}
+ else
+ { // This object is cached an waiting for it's resurrection by the users.
+ Hit = TRUE;
+ }
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
}
_SEH2_END;
+ if (Hit)
+ {
+ REGION_UnlockRgn(pRgn);
+ return NULL;
+ }
if (ppRgn_Attr)
*ppRgn_Attr = pRgn_Attr;
}