Author: tkreuzer
Date: Fri Dec 19 12:53:50 2014
New Revision: 65748
URL:
http://svn.reactos.org/svn/reactos?rev=65748&view=rev
Log:
[WIN32K]
Handle coordinate translation in NtGdiOffsetClipRgn
Modified:
trunk/reactos/win32ss/gdi/gdi32/objects/region.c
trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c
Modified: trunk/reactos/win32ss/gdi/gdi32/objects/region.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/objects/region.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/objects/region.c [iso-8859-1] Fri Dec 19 12:53:50
2014
@@ -984,6 +984,11 @@
int nXOffset,
int nYOffset)
{
+ if (hdc == NULL)
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return ERROR;
+ }
#if 0
// Handle something other than a normal dc object.
if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)
Modified: trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/cliprgn.…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c [iso-8859-1] Fri Dec 19 12:53:50 2014
@@ -350,41 +350,59 @@
return iComplexity;
}
-int APIENTRY NtGdiOffsetClipRgn(HDC hDC,
- int XOffset,
- int YOffset)
-{
- INT Result;
- DC *dc;
-
- if(!(dc = DC_LockDc(hDC)))
- {
- EngSetLastError(ERROR_INVALID_HANDLE);
+INT
+APIENTRY
+NtGdiOffsetClipRgn(
+ _In_ HDC hdc,
+ _In_ INT xOffset,
+ _In_ INT yOffset)
+{
+ INT iComplexity;
+ PDC pdc;
+ POINTL apt[2];
+
+ /* Lock the DC */
+ pdc = DC_LockDc(hdc);
+ if (pdc == NULL)
+ {
return ERROR;
}
- if(dc->dclevel.prgnClip != NULL)
- {
- if (!REGION_bOffsetRgn(dc->dclevel.prgnClip,
- XOffset,
- YOffset))
- {
- Result = ERROR;
+ /* Check if we have a clip region */
+ if (pdc->dclevel.prgnClip != NULL)
+ {
+ /* Convert coordinates into device space. Note that we need to convert
+ 2 coordinates to account for rotation / shear / offset */
+ apt[0].x = 0;
+ apt[0].y = 0;
+ apt[1].x = xOffset;
+ apt[1].y = yOffset;
+ IntLPtoDP(pdc, &apt, 2);
+
+ /* Offset the clip region */
+ if (!REGION_bOffsetRgn(pdc->dclevel.prgnClip,
+ apt[1].x - apt[0].x,
+ apt[1].y - apt[0].y))
+ {
+ iComplexity = ERROR;
}
else
{
- Result = REGION_Complexity(dc->dclevel.prgnClip);
- }
-
- dc->fs |= DC_FLAG_DIRTY_RAO;
+ iComplexity = REGION_Complexity(pdc->dclevel.prgnClip);
+ }
+
+ /* Mark the RAO region as dirty */
+ pdc->fs |= DC_FLAG_DIRTY_RAO;
}
else
{
- Result = NULLREGION;
- }
-
- DC_UnlockDc(dc);
- return Result;
+ /* NULL means no clipping, i.e. the "whole" region */
+ iComplexity = SIMPLEREGION;
+ }
+
+ /* Unlock the DC and return the complexity */
+ DC_UnlockDc(pdc);
+ return iComplexity;
}
BOOL APIENTRY NtGdiPtVisible(HDC hDC,
@@ -472,6 +490,7 @@
{
if ( pDC->dclevel.prgnClip )
{
+ // preferably REGION_IntersectRegion
Ret = IntGdiCombineRgn(pDC->dclevel.prgnMeta, pDC->dclevel.prgnMeta,
pDC->dclevel.prgnClip, RGN_AND);
if (Ret != ERROR)
{