Author: fireball
Date: Thu Nov 5 14:38:01 2009
New Revision: 43974
URL:
http://svn.reactos.org/svn/reactos?rev=43974&view=rev
Log:
- Fix incorrect clipping calculation when empty region is passed to RosDeviceSetClipping.
Instead of setting clipping to full underlying surface access, it should set it to the dc
rectangle intersected with the underlying surface rect. Fixes visual glitch when painting
non-client area of a window.
- Fix a typo which lead to using stack allocated RECTs array only for one rectangle
instead of 8 possible. This fix reduces pool memory allocations for complex regions.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] Thu Nov 5
14:38:01 2009
@@ -452,7 +452,7 @@
PDC pDC;
RECTL pStackBuf[8];
RECTL *pSafeRects = pStackBuf;
- RECTL rcSafeBounds;
+ RECTL rcSafeBounds, rcSurface;
ULONG i;
NTSTATUS Status = STATUS_SUCCESS;
@@ -467,7 +467,7 @@
ProbeForRead(pRects, count * sizeof(RECTL), 1);
/* Use pool allocated buffer if data doesn't fit */
- if (count > sizeof(*pStackBuf) / sizeof(RECTL))
+ if (count > sizeof(pStackBuf) / sizeof(RECTL))
pSafeRects = ExAllocatePool(PagedPool, sizeof(RECTL) * count);
/* Copy points data */
@@ -515,19 +515,24 @@
if (count == 0)
{
- /* Special case, set it to full screen then */
- /*RECTL_vSetRect(&rcSafeBounds,
- pDC->rcVport.left,
- pDC->rcVport.top,
- pDC->rcVport.right,
- pDC->rcVport.bottom);*/
-
+ /* Set unclipped mode (clip by dc rect) */
RECTL_vSetRect(&rcSafeBounds,
+ pDC->rcDcRect.left,
+ pDC->rcDcRect.top,
+ pDC->rcDcRect.right,
+ pDC->rcDcRect.bottom);
+
+ RECTL_vOffsetRect(&rcSafeBounds, pDC->rcVport.left, pDC->rcVport.top);
+
+ /* Intersect it with an underlying surface rectangle */
+ RECTL_vSetRect(&rcSurface,
0,
0,
pDC->pBitmap->SurfObj.sizlBitmap.cx,
pDC->pBitmap->SurfObj.sizlBitmap.cy);
+ RECTL_bIntersectRect(&rcSafeBounds, &rcSafeBounds, &rcSurface);
+
/* Set the clipping object */
pDC->CombinedClip = IntEngCreateClipRegion(1, &rcSafeBounds,
&rcSafeBounds);
}