2003-05-18 17:16:18 +00:00
|
|
|
/*
|
|
|
|
* ReactOS W32 Subsystem
|
|
|
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2003-05-18 17:16:18 +00:00
|
|
|
*/
|
2005-06-29 07:09:25 +00:00
|
|
|
|
2010-04-26 13:58:46 +00:00
|
|
|
#include <win32k.h>
|
1999-07-22 16:21:53 +00:00
|
|
|
|
2005-06-29 07:09:25 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2004-05-26 18:49:06 +00:00
|
|
|
int FASTCALL
|
2002-09-01 20:39:56 +00:00
|
|
|
CLIPPING_UpdateGCRegion(DC* Dc)
|
|
|
|
{
|
2004-05-14 16:55:18 +00:00
|
|
|
PROSRGNDATA CombinedRegion;
|
2010-07-14 16:12:32 +00:00
|
|
|
HRGN hRgnVis = Dc->prgnVis->BaseObject.hHmgr;
|
2003-06-28 08:39:18 +00:00
|
|
|
|
2010-01-25 01:33:01 +00:00
|
|
|
/* Experiment with API region based on wine.. */
|
|
|
|
if (Dc->rosdc.hClipRgn && Dc->dclevel.prgnMeta)
|
2010-01-21 13:18:33 +00:00
|
|
|
{
|
2010-01-25 01:33:01 +00:00
|
|
|
PROSRGNDATA pClipRgn;
|
|
|
|
|
|
|
|
if ((pClipRgn = RGNOBJAPI_Lock(Dc->rosdc.hClipRgn, NULL)))
|
|
|
|
{
|
|
|
|
if (!Dc->prgnAPI) Dc->prgnAPI = IntSysCreateRectpRgn( 0, 0, 0, 0 );
|
|
|
|
|
|
|
|
IntGdiCombineRgn( Dc->prgnAPI,
|
|
|
|
pClipRgn,
|
|
|
|
Dc->dclevel.prgnMeta,
|
|
|
|
RGN_AND );
|
|
|
|
RGNOBJAPI_Unlock(pClipRgn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (Dc->prgnAPI)
|
|
|
|
GreDeleteObject(((PROSRGNDATA)Dc->prgnAPI)->BaseObject.hHmgr);
|
|
|
|
Dc->prgnAPI = NULL;
|
2010-01-21 13:18:33 +00:00
|
|
|
}
|
|
|
|
|
2010-07-12 16:52:10 +00:00
|
|
|
|
2009-03-20 01:35:49 +00:00
|
|
|
if (Dc->rosdc.hGCClipRgn == NULL)
|
2010-01-21 13:18:33 +00:00
|
|
|
Dc->rosdc.hGCClipRgn = IntSysCreateRectRgn(0, 0, 0, 0);
|
2003-08-29 09:29:11 +00:00
|
|
|
|
2009-03-20 01:35:49 +00:00
|
|
|
if (Dc->rosdc.hClipRgn == NULL)
|
2010-07-14 16:12:32 +00:00
|
|
|
NtGdiCombineRgn(Dc->rosdc.hGCClipRgn, hRgnVis, 0, RGN_COPY);
|
2010-01-25 01:33:01 +00:00
|
|
|
else
|
2010-07-12 16:52:10 +00:00
|
|
|
NtGdiCombineRgn(Dc->rosdc.hGCClipRgn, Dc->rosdc.hClipRgn, hRgnVis, RGN_AND);
|
2010-01-25 01:33:01 +00:00
|
|
|
|
2009-03-20 01:35:49 +00:00
|
|
|
NtGdiOffsetRgn(Dc->rosdc.hGCClipRgn, Dc->ptlDCOrig.x, Dc->ptlDCOrig.y);
|
2003-06-28 08:39:18 +00:00
|
|
|
|
2010-05-25 11:41:29 +00:00
|
|
|
if((CombinedRegion = RGNOBJAPI_Lock(Dc->rosdc.hGCClipRgn, NULL)))
|
|
|
|
{
|
|
|
|
CLIPOBJ *CombinedClip;
|
|
|
|
|
|
|
|
CombinedClip = IntEngCreateClipRegion(CombinedRegion->rdh.nCount,
|
|
|
|
CombinedRegion->Buffer,
|
|
|
|
&CombinedRegion->rdh.rcBound);
|
|
|
|
|
|
|
|
RGNOBJAPI_Unlock(CombinedRegion);
|
|
|
|
|
|
|
|
if (!CombinedClip)
|
|
|
|
{
|
|
|
|
DPRINT1("IntEngCreateClipRegion() failed\n");
|
|
|
|
return ERROR;
|
|
|
|
}
|
2003-06-28 08:39:18 +00:00
|
|
|
|
2010-05-25 11:41:29 +00:00
|
|
|
if (Dc->rosdc.CombinedClip != NULL)
|
|
|
|
IntEngDeleteClipRegion(Dc->rosdc.CombinedClip);
|
2003-06-28 08:39:18 +00:00
|
|
|
|
2010-05-25 11:41:29 +00:00
|
|
|
Dc->rosdc.CombinedClip = CombinedClip;
|
|
|
|
}
|
2003-06-28 08:39:18 +00:00
|
|
|
|
2004-12-12 01:40:39 +00:00
|
|
|
|
2009-03-20 01:35:49 +00:00
|
|
|
return NtGdiOffsetRgn(Dc->rosdc.hGCClipRgn, -Dc->ptlDCOrig.x, -Dc->ptlDCOrig.y);
|
2002-09-01 20:39:56 +00:00
|
|
|
}
|
|
|
|
|
2008-05-27 01:38:01 +00:00
|
|
|
INT FASTCALL
|
|
|
|
GdiSelectVisRgn(HDC hdc, HRGN hrgn)
|
2002-07-13 21:37:27 +00:00
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
DC *dc;
|
|
|
|
|
2003-01-18 20:47:32 +00:00
|
|
|
if (!hrgn)
|
2004-04-25 15:52:31 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
2003-01-18 20:47:32 +00:00
|
|
|
return ERROR;
|
2004-04-25 15:52:31 +00:00
|
|
|
}
|
2003-08-20 07:45:02 +00:00
|
|
|
if (!(dc = DC_LockDc(hdc)))
|
2004-04-25 15:52:31 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
2003-01-18 20:47:32 +00:00
|
|
|
return ERROR;
|
2004-04-25 15:52:31 +00:00
|
|
|
}
|
2002-07-13 21:37:27 +00:00
|
|
|
|
2009-03-20 01:35:49 +00:00
|
|
|
dc->fs &= ~DC_FLAG_DIRTY_RAO;
|
2010-07-12 16:52:10 +00:00
|
|
|
|
2010-08-21 19:55:09 +00:00
|
|
|
ASSERT (dc->prgnVis != NULL);
|
2003-07-14 17:36:59 +00:00
|
|
|
|
2010-07-12 16:52:10 +00:00
|
|
|
retval = NtGdiCombineRgn(((PROSRGNDATA)dc->prgnVis)->BaseObject.hHmgr, hrgn, 0, RGN_COPY);
|
2004-12-07 19:53:44 +00:00
|
|
|
if ( retval != ERROR )
|
2007-07-30 01:26:57 +00:00
|
|
|
{
|
2010-07-12 16:52:10 +00:00
|
|
|
NtGdiOffsetRgn(((PROSRGNDATA)dc->prgnVis)->BaseObject.hHmgr, -dc->ptlDCOrig.x, -dc->ptlDCOrig.y);
|
2007-07-30 01:26:57 +00:00
|
|
|
CLIPPING_UpdateGCRegion(dc);
|
|
|
|
}
|
2010-01-25 01:33:01 +00:00
|
|
|
|
2005-06-07 16:34:07 +00:00
|
|
|
DC_UnlockDc(dc);
|
2002-07-13 21:37:27 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2005-12-09 18:06:19 +00:00
|
|
|
|
2008-05-27 01:38:01 +00:00
|
|
|
int FASTCALL GdiExtSelectClipRgn(PDC dc,
|
2009-12-19 13:08:53 +00:00
|
|
|
HRGN hrgn,
|
|
|
|
int fnMode)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-03-20 01:35:49 +00:00
|
|
|
// dc->fs &= ~DC_FLAG_DIRTY_RAO;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2004-04-25 16:40:39 +00:00
|
|
|
if (!hrgn)
|
|
|
|
{
|
|
|
|
if (fnMode == RGN_COPY)
|
|
|
|
{
|
2009-03-20 01:35:49 +00:00
|
|
|
if (dc->rosdc.hClipRgn != NULL)
|
2004-05-14 16:55:18 +00:00
|
|
|
{
|
2010-01-21 13:18:33 +00:00
|
|
|
REGION_FreeRgnByHandle(dc->rosdc.hClipRgn);
|
2009-03-20 01:35:49 +00:00
|
|
|
dc->rosdc.hClipRgn = NULL;
|
2004-05-14 16:55:18 +00:00
|
|
|
}
|
2004-04-25 16:40:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-20 01:35:49 +00:00
|
|
|
if (!dc->rosdc.hClipRgn)
|
2004-04-25 16:40:39 +00:00
|
|
|
{
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL rect;
|
2010-07-12 16:52:10 +00:00
|
|
|
if(dc->prgnVis)
|
2004-04-25 16:40:39 +00:00
|
|
|
{
|
2010-07-12 16:52:10 +00:00
|
|
|
REGION_GetRgnBox(dc->prgnVis, &rect);
|
2010-01-21 13:18:33 +00:00
|
|
|
dc->rosdc.hClipRgn = IntSysCreateRectRgnIndirect(&rect);
|
2004-04-25 16:40:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-21 13:18:33 +00:00
|
|
|
dc->rosdc.hClipRgn = IntSysCreateRectRgn(0, 0, 0, 0);
|
2004-04-25 16:40:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(fnMode == RGN_COPY)
|
2004-05-14 16:55:18 +00:00
|
|
|
{
|
2009-03-20 01:35:49 +00:00
|
|
|
NtGdiCombineRgn(dc->rosdc.hClipRgn, hrgn, 0, fnMode);
|
2004-05-14 16:55:18 +00:00
|
|
|
}
|
2004-04-25 16:40:39 +00:00
|
|
|
else
|
2009-03-20 01:35:49 +00:00
|
|
|
NtGdiCombineRgn(dc->rosdc.hClipRgn, dc->rosdc.hClipRgn, hrgn, fnMode);
|
2004-04-25 16:40:39 +00:00
|
|
|
}
|
2009-12-19 13:08:53 +00:00
|
|
|
return CLIPPING_UpdateGCRegion(dc);
|
2005-12-09 18:06:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
int APIENTRY NtGdiExtSelectClipRgn(HDC hDC,
|
2008-05-27 01:38:01 +00:00
|
|
|
HRGN hrgn,
|
|
|
|
int fnMode)
|
2005-12-09 18:06:19 +00:00
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
DC *dc;
|
|
|
|
|
|
|
|
if (!(dc = DC_LockDc(hDC)))
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return ERROR;
|
|
|
|
}
|
2004-04-25 16:40:39 +00:00
|
|
|
|
2008-05-27 01:38:01 +00:00
|
|
|
retval = GdiExtSelectClipRgn ( dc, hrgn, fnMode );
|
2005-12-09 18:06:19 +00:00
|
|
|
|
|
|
|
DC_UnlockDc(dc);
|
2004-04-25 16:40:39 +00:00
|
|
|
return retval;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2004-05-14 16:55:18 +00:00
|
|
|
INT FASTCALL
|
2009-03-19 01:42:34 +00:00
|
|
|
GdiGetClipBox(HDC hDC, PRECTL rc)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2004-05-14 16:55:18 +00:00
|
|
|
INT retval;
|
|
|
|
PDC dc;
|
2010-07-12 16:52:10 +00:00
|
|
|
PROSRGNDATA pRgnNew, pRgn = NULL;
|
|
|
|
BOOL Unlock = FALSE; //Small hack
|
2002-08-27 23:29:40 +00:00
|
|
|
|
2004-05-14 16:55:18 +00:00
|
|
|
if (!(dc = DC_LockDc(hDC)))
|
|
|
|
{
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
|
2010-02-23 03:17:37 +00:00
|
|
|
/* FIXME! Rao and Vis only! */
|
2010-01-25 01:33:01 +00:00
|
|
|
if (dc->prgnAPI) // APIRGN
|
|
|
|
{
|
2010-07-12 16:52:10 +00:00
|
|
|
pRgn = dc->prgnAPI;
|
2010-01-25 01:33:01 +00:00
|
|
|
}
|
|
|
|
else if (dc->dclevel.prgnMeta) // METARGN
|
|
|
|
{
|
2010-07-12 16:52:10 +00:00
|
|
|
pRgn = dc->dclevel.prgnMeta;
|
2010-01-25 01:33:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-07-12 16:52:10 +00:00
|
|
|
Unlock = TRUE ;
|
|
|
|
pRgn = REGION_LockRgn(dc->rosdc.hClipRgn); // CLIPRGN
|
2010-01-25 01:33:01 +00:00
|
|
|
}
|
|
|
|
|
2010-07-12 16:52:10 +00:00
|
|
|
if (pRgn)
|
2010-01-25 01:33:01 +00:00
|
|
|
{
|
2010-07-12 16:52:10 +00:00
|
|
|
pRgnNew = IntSysCreateRectpRgn( 0, 0, 0, 0 );
|
2010-01-25 01:33:01 +00:00
|
|
|
|
2010-07-12 16:52:10 +00:00
|
|
|
if (!pRgnNew)
|
2010-01-25 01:33:01 +00:00
|
|
|
{
|
|
|
|
DC_UnlockDc(dc);
|
2010-07-12 16:52:10 +00:00
|
|
|
if(Unlock) REGION_UnlockRgn(pRgn);
|
2010-01-25 01:33:01 +00:00
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
|
2010-07-12 16:52:10 +00:00
|
|
|
IntGdiCombineRgn(pRgnNew, dc->prgnVis, pRgn, RGN_AND);
|
|
|
|
|
|
|
|
retval = REGION_GetRgnBox(pRgnNew, rc);
|
2010-01-25 01:33:01 +00:00
|
|
|
|
2010-07-12 16:52:10 +00:00
|
|
|
REGION_FreeRgnByHandle(pRgnNew->BaseObject.hHmgr);
|
2010-01-25 01:33:01 +00:00
|
|
|
DC_UnlockDc(dc);
|
2010-07-12 16:52:10 +00:00
|
|
|
if(Unlock) REGION_UnlockRgn(pRgn);
|
2010-01-25 01:33:01 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2010-07-12 16:52:10 +00:00
|
|
|
retval = REGION_GetRgnBox(dc->prgnVis, rc);
|
2004-05-14 16:55:18 +00:00
|
|
|
IntDPtoLP(dc, (LPPOINT)rc, 2);
|
2005-06-07 16:34:07 +00:00
|
|
|
DC_UnlockDc(dc);
|
2004-05-14 16:55:18 +00:00
|
|
|
|
|
|
|
return retval;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
INT APIENTRY
|
2009-03-19 01:42:34 +00:00
|
|
|
NtGdiGetAppClipBox(HDC hDC, PRECTL rc)
|
2003-12-13 12:12:41 +00:00
|
|
|
{
|
2007-11-08 14:29:31 +00:00
|
|
|
INT Ret;
|
2005-08-03 20:15:58 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL Saferect;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2008-05-27 01:38:01 +00:00
|
|
|
Ret = GdiGetClipBox(hDC, &Saferect);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_TRY
|
2005-07-26 12:22:55 +00:00
|
|
|
{
|
|
|
|
ProbeForWrite(rc,
|
|
|
|
sizeof(RECT),
|
|
|
|
1);
|
|
|
|
*rc = Saferect;
|
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2005-07-26 12:22:55 +00:00
|
|
|
{
|
2008-11-30 19:28:11 +00:00
|
|
|
Status = _SEH2_GetExceptionCode();
|
2005-07-26 12:22:55 +00:00
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_END;
|
2005-07-26 12:22:55 +00:00
|
|
|
|
2003-12-13 12:12:41 +00:00
|
|
|
if(!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
return ERROR;
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2003-12-13 12:12:41 +00:00
|
|
|
return Ret;
|
|
|
|
}
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
int APIENTRY NtGdiExcludeClipRect(HDC hDC,
|
2004-04-25 16:06:20 +00:00
|
|
|
int LeftRect,
|
|
|
|
int TopRect,
|
|
|
|
int RightRect,
|
|
|
|
int BottomRect)
|
|
|
|
{
|
|
|
|
INT Result;
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL Rect;
|
2004-04-25 16:06:20 +00:00
|
|
|
HRGN NewRgn;
|
|
|
|
PDC dc = DC_LockDc(hDC);
|
|
|
|
|
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
Rect.left = LeftRect;
|
|
|
|
Rect.top = TopRect;
|
|
|
|
Rect.right = RightRect;
|
|
|
|
Rect.bottom = BottomRect;
|
|
|
|
|
|
|
|
IntLPtoDP(dc, (LPPOINT)&Rect, 2);
|
|
|
|
|
2010-01-21 13:18:33 +00:00
|
|
|
NewRgn = IntSysCreateRectRgnIndirect(&Rect);
|
2004-04-25 16:06:20 +00:00
|
|
|
if (!NewRgn)
|
|
|
|
{
|
|
|
|
Result = ERROR;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-20 01:35:49 +00:00
|
|
|
if (!dc->rosdc.hClipRgn)
|
2004-07-07 16:34:33 +00:00
|
|
|
{
|
2010-01-21 13:18:33 +00:00
|
|
|
dc->rosdc.hClipRgn = IntSysCreateRectRgn(0, 0, 0, 0);
|
2010-07-12 16:52:10 +00:00
|
|
|
NtGdiCombineRgn(dc->rosdc.hClipRgn, ((PROSRGNDATA)dc->prgnVis)->BaseObject.hHmgr, NewRgn, RGN_DIFF);
|
2004-07-07 16:34:33 +00:00
|
|
|
Result = SIMPLEREGION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-20 01:35:49 +00:00
|
|
|
Result = NtGdiCombineRgn(dc->rosdc.hClipRgn, dc->rosdc.hClipRgn, NewRgn, RGN_DIFF);
|
2004-07-07 16:34:33 +00:00
|
|
|
}
|
2010-01-21 13:18:33 +00:00
|
|
|
REGION_FreeRgnByHandle(NewRgn);
|
2004-04-25 16:06:20 +00:00
|
|
|
}
|
|
|
|
if (Result != ERROR)
|
|
|
|
CLIPPING_UpdateGCRegion(dc);
|
|
|
|
|
2005-06-07 16:34:07 +00:00
|
|
|
DC_UnlockDc(dc);
|
2004-04-25 16:06:20 +00:00
|
|
|
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
int APIENTRY NtGdiIntersectClipRect(HDC hDC,
|
1999-07-22 16:21:53 +00:00
|
|
|
int LeftRect,
|
|
|
|
int TopRect,
|
|
|
|
int RightRect,
|
|
|
|
int BottomRect)
|
|
|
|
{
|
2003-12-21 18:38:37 +00:00
|
|
|
INT Result;
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL Rect;
|
2003-12-21 18:38:37 +00:00
|
|
|
HRGN NewRgn;
|
|
|
|
PDC dc = DC_LockDc(hDC);
|
|
|
|
|
2004-05-14 16:55:18 +00:00
|
|
|
DPRINT("NtGdiIntersectClipRect(%x, %d,%d-%d,%d)\n",
|
|
|
|
hDC, LeftRect, TopRect, RightRect, BottomRect);
|
|
|
|
|
2003-12-21 18:38:37 +00:00
|
|
|
if (!dc)
|
2004-04-25 15:52:31 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
2003-12-21 18:38:37 +00:00
|
|
|
return ERROR;
|
2004-04-25 15:52:31 +00:00
|
|
|
}
|
2003-12-21 18:38:37 +00:00
|
|
|
|
|
|
|
Rect.left = LeftRect;
|
|
|
|
Rect.top = TopRect;
|
|
|
|
Rect.right = RightRect;
|
|
|
|
Rect.bottom = BottomRect;
|
|
|
|
|
|
|
|
IntLPtoDP(dc, (LPPOINT)&Rect, 2);
|
|
|
|
|
2010-01-21 13:18:33 +00:00
|
|
|
NewRgn = IntSysCreateRectRgnIndirect(&Rect);
|
2003-12-21 18:38:37 +00:00
|
|
|
if (!NewRgn)
|
|
|
|
{
|
|
|
|
Result = ERROR;
|
|
|
|
}
|
2009-03-20 01:35:49 +00:00
|
|
|
else if (!dc->rosdc.hClipRgn)
|
2003-12-21 18:38:37 +00:00
|
|
|
{
|
2009-03-20 01:35:49 +00:00
|
|
|
dc->rosdc.hClipRgn = NewRgn;
|
2003-12-21 18:38:37 +00:00
|
|
|
Result = SIMPLEREGION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-20 01:35:49 +00:00
|
|
|
Result = NtGdiCombineRgn(dc->rosdc.hClipRgn, dc->rosdc.hClipRgn, NewRgn, RGN_AND);
|
2010-01-21 13:18:33 +00:00
|
|
|
REGION_FreeRgnByHandle(NewRgn);
|
2003-12-21 18:38:37 +00:00
|
|
|
}
|
|
|
|
if (Result != ERROR)
|
|
|
|
CLIPPING_UpdateGCRegion(dc);
|
|
|
|
|
2005-06-07 16:34:07 +00:00
|
|
|
DC_UnlockDc(dc);
|
2003-12-21 18:38:37 +00:00
|
|
|
|
|
|
|
return Result;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
int APIENTRY NtGdiOffsetClipRgn(HDC hDC,
|
1999-07-22 16:21:53 +00:00
|
|
|
int XOffset,
|
|
|
|
int YOffset)
|
|
|
|
{
|
2005-08-03 20:15:58 +00:00
|
|
|
INT Result;
|
|
|
|
DC *dc;
|
|
|
|
|
|
|
|
if(!(dc = DC_LockDc(hDC)))
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
|
2009-03-20 01:35:49 +00:00
|
|
|
if(dc->rosdc.hClipRgn != NULL)
|
2005-08-03 20:15:58 +00:00
|
|
|
{
|
2009-03-20 01:35:49 +00:00
|
|
|
Result = NtGdiOffsetRgn(dc->rosdc.hClipRgn,
|
2005-08-03 20:15:58 +00:00
|
|
|
XOffset,
|
|
|
|
YOffset);
|
2005-10-23 09:54:12 +00:00
|
|
|
CLIPPING_UpdateGCRegion(dc);
|
2005-08-03 20:15:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Result = NULLREGION;
|
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2005-08-03 20:15:58 +00:00
|
|
|
DC_UnlockDc(dc);
|
|
|
|
return Result;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
BOOL APIENTRY NtGdiPtVisible(HDC hDC,
|
1999-07-22 16:21:53 +00:00
|
|
|
int X,
|
|
|
|
int Y)
|
|
|
|
{
|
2004-04-26 19:58:45 +00:00
|
|
|
HRGN rgn;
|
2004-04-25 15:52:31 +00:00
|
|
|
DC *dc;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2004-04-25 15:52:31 +00:00
|
|
|
if(!(dc = DC_LockDc(hDC)))
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2009-03-20 01:35:49 +00:00
|
|
|
rgn = dc->rosdc.hGCClipRgn;
|
2005-06-07 16:34:07 +00:00
|
|
|
DC_UnlockDc(dc);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2004-04-26 19:58:45 +00:00
|
|
|
return (rgn ? NtGdiPtInRegion(rgn, X, Y) : FALSE);
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
BOOL APIENTRY NtGdiRectVisible(HDC hDC,
|
2009-03-19 01:42:34 +00:00
|
|
|
LPRECT UnsafeRect)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2005-07-26 12:22:55 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
2004-03-22 20:14:29 +00:00
|
|
|
PROSRGNDATA Rgn;
|
2003-12-15 20:47:57 +00:00
|
|
|
PDC dc = DC_LockDc(hDC);
|
|
|
|
BOOL Result = FALSE;
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL Rect;
|
2003-12-15 20:47:57 +00:00
|
|
|
|
|
|
|
if (!dc)
|
|
|
|
{
|
2004-04-25 15:52:31 +00:00
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
2003-12-15 20:47:57 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_TRY
|
2005-07-26 12:22:55 +00:00
|
|
|
{
|
|
|
|
ProbeForRead(UnsafeRect,
|
|
|
|
sizeof(RECT),
|
|
|
|
1);
|
|
|
|
Rect = *UnsafeRect;
|
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2005-07-26 12:22:55 +00:00
|
|
|
{
|
2008-11-30 19:28:11 +00:00
|
|
|
Status = _SEH2_GetExceptionCode();
|
2005-07-26 12:22:55 +00:00
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_END;
|
2005-07-26 12:22:55 +00:00
|
|
|
|
2004-03-22 20:14:29 +00:00
|
|
|
if(!NT_SUCCESS(Status))
|
|
|
|
{
|
2005-06-07 16:34:07 +00:00
|
|
|
DC_UnlockDc(dc);
|
2005-07-26 12:22:55 +00:00
|
|
|
SetLastNtError(Status);
|
2004-03-22 20:14:29 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2003-12-15 20:47:57 +00:00
|
|
|
|
2009-03-20 01:35:49 +00:00
|
|
|
if (dc->rosdc.hGCClipRgn)
|
2003-12-15 20:47:57 +00:00
|
|
|
{
|
2009-12-29 21:07:04 +00:00
|
|
|
if((Rgn = (PROSRGNDATA)RGNOBJAPI_Lock(dc->rosdc.hGCClipRgn, NULL)))
|
2004-03-22 20:14:29 +00:00
|
|
|
{
|
|
|
|
IntLPtoDP(dc, (LPPOINT)&Rect, 2);
|
2008-03-17 22:17:48 +00:00
|
|
|
Result = REGION_RectInRegion(Rgn, &Rect);
|
2009-12-29 21:07:04 +00:00
|
|
|
RGNOBJAPI_Unlock(Rgn);
|
2004-03-22 20:14:29 +00:00
|
|
|
}
|
2003-12-15 20:47:57 +00:00
|
|
|
}
|
2005-06-07 16:34:07 +00:00
|
|
|
DC_UnlockDc(dc);
|
2003-12-15 20:47:57 +00:00
|
|
|
|
|
|
|
return Result;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2008-05-23 00:29:08 +00:00
|
|
|
int
|
2010-07-12 16:52:10 +00:00
|
|
|
FASTCALL
|
2008-05-23 00:29:08 +00:00
|
|
|
IntGdiSetMetaRgn(PDC pDC)
|
|
|
|
{
|
|
|
|
INT Ret = ERROR;
|
|
|
|
PROSRGNDATA TempRgn;
|
|
|
|
|
2009-03-20 14:16:01 +00:00
|
|
|
if ( pDC->dclevel.prgnMeta )
|
2008-05-23 00:29:08 +00:00
|
|
|
{
|
2009-03-20 14:16:01 +00:00
|
|
|
if ( pDC->dclevel.prgnClip )
|
2008-05-23 00:29:08 +00:00
|
|
|
{
|
2010-01-25 01:33:01 +00:00
|
|
|
TempRgn = IntSysCreateRectpRgn(0,0,0,0);
|
2008-05-23 00:29:08 +00:00
|
|
|
if (TempRgn)
|
2010-07-12 16:52:10 +00:00
|
|
|
{
|
2008-05-23 00:29:08 +00:00
|
|
|
Ret = IntGdiCombineRgn( TempRgn,
|
2009-03-20 14:16:01 +00:00
|
|
|
pDC->dclevel.prgnMeta,
|
|
|
|
pDC->dclevel.prgnClip,
|
2008-05-23 00:29:08 +00:00
|
|
|
RGN_AND);
|
|
|
|
if ( Ret )
|
|
|
|
{
|
2009-03-20 14:16:01 +00:00
|
|
|
GDIOBJ_ShareUnlockObjByPtr(pDC->dclevel.prgnMeta);
|
|
|
|
if (!((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.ulShareCount)
|
|
|
|
REGION_Delete(pDC->dclevel.prgnMeta);
|
2008-05-23 00:29:08 +00:00
|
|
|
|
2009-03-20 14:16:01 +00:00
|
|
|
pDC->dclevel.prgnMeta = TempRgn;
|
2008-05-23 00:29:08 +00:00
|
|
|
|
2009-03-20 14:16:01 +00:00
|
|
|
GDIOBJ_ShareUnlockObjByPtr(pDC->dclevel.prgnClip);
|
|
|
|
if (!((PROSRGNDATA)pDC->dclevel.prgnClip)->BaseObject.ulShareCount)
|
|
|
|
REGION_Delete(pDC->dclevel.prgnClip);
|
2008-05-23 00:29:08 +00:00
|
|
|
|
2009-03-20 14:16:01 +00:00
|
|
|
pDC->dclevel.prgnClip = NULL;
|
2008-05-23 00:29:08 +00:00
|
|
|
|
2008-06-17 05:19:08 +00:00
|
|
|
IntGdiReleaseRaoRgn(pDC);
|
2008-05-23 00:29:08 +00:00
|
|
|
}
|
|
|
|
else
|
2008-06-17 05:19:08 +00:00
|
|
|
REGION_Delete(TempRgn);
|
2008-05-23 00:29:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2009-03-20 14:16:01 +00:00
|
|
|
Ret = REGION_Complexity(pDC->dclevel.prgnMeta);
|
2008-05-23 00:29:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-20 14:16:01 +00:00
|
|
|
if ( pDC->dclevel.prgnClip )
|
2008-05-23 00:29:08 +00:00
|
|
|
{
|
2009-03-20 14:16:01 +00:00
|
|
|
Ret = REGION_Complexity(pDC->dclevel.prgnClip);
|
|
|
|
pDC->dclevel.prgnMeta = pDC->dclevel.prgnClip;
|
|
|
|
pDC->dclevel.prgnClip = NULL;
|
2008-05-23 00:29:08 +00:00
|
|
|
}
|
2010-07-12 16:52:10 +00:00
|
|
|
else
|
2008-05-23 00:29:08 +00:00
|
|
|
Ret = SIMPLEREGION;
|
|
|
|
}
|
|
|
|
return Ret;
|
|
|
|
}
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
int APIENTRY NtGdiSetMetaRgn(HDC hDC)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2008-05-23 00:29:08 +00:00
|
|
|
INT Ret;
|
|
|
|
PDC pDC = DC_LockDc(hDC);
|
|
|
|
|
|
|
|
if (!pDC)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
Ret = IntGdiSetMetaRgn(pDC);
|
|
|
|
|
|
|
|
DC_UnlockDc(pDC);
|
|
|
|
return Ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
INT FASTCALL
|
|
|
|
NEW_CLIPPING_UpdateGCRegion(PDC pDC)
|
|
|
|
{
|
|
|
|
CLIPOBJ * co;
|
|
|
|
|
2010-01-25 01:33:01 +00:00
|
|
|
/* Must have VisRgn set to a valid state! */
|
|
|
|
if (!pDC->prgnVis) return ERROR;
|
2008-05-23 00:29:08 +00:00
|
|
|
|
|
|
|
if (pDC->prgnAPI)
|
|
|
|
{
|
2008-06-17 05:19:08 +00:00
|
|
|
REGION_Delete(pDC->prgnAPI);
|
2010-01-25 01:33:01 +00:00
|
|
|
pDC->prgnAPI = IntSysCreateRectpRgn(0,0,0,0);
|
2008-05-23 00:29:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pDC->prgnRao)
|
|
|
|
{
|
2008-06-17 05:19:08 +00:00
|
|
|
REGION_Delete(pDC->prgnRao);
|
2010-01-25 01:33:01 +00:00
|
|
|
pDC->prgnRao = IntSysCreateRectpRgn(0,0,0,0);
|
2008-05-23 00:29:08 +00:00
|
|
|
}
|
2010-07-12 16:52:10 +00:00
|
|
|
|
2009-03-20 14:16:01 +00:00
|
|
|
if (pDC->dclevel.prgnMeta && pDC->dclevel.prgnClip)
|
2008-05-23 00:29:08 +00:00
|
|
|
{
|
|
|
|
IntGdiCombineRgn( pDC->prgnAPI,
|
2010-01-25 01:33:01 +00:00
|
|
|
pDC->dclevel.prgnClip,
|
|
|
|
pDC->dclevel.prgnMeta,
|
|
|
|
RGN_AND );
|
2008-05-23 00:29:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-20 14:16:01 +00:00
|
|
|
if (pDC->dclevel.prgnClip)
|
2010-01-25 01:33:01 +00:00
|
|
|
{
|
2008-05-23 00:29:08 +00:00
|
|
|
IntGdiCombineRgn( pDC->prgnAPI,
|
2010-01-25 01:33:01 +00:00
|
|
|
pDC->dclevel.prgnClip,
|
|
|
|
NULL,
|
|
|
|
RGN_COPY );
|
|
|
|
}
|
2009-03-20 14:16:01 +00:00
|
|
|
else if (pDC->dclevel.prgnMeta)
|
2010-01-25 01:33:01 +00:00
|
|
|
{
|
2008-05-23 00:29:08 +00:00
|
|
|
IntGdiCombineRgn( pDC->prgnAPI,
|
2010-01-25 01:33:01 +00:00
|
|
|
pDC->dclevel.prgnMeta,
|
|
|
|
NULL,
|
|
|
|
RGN_COPY );
|
|
|
|
}
|
2008-05-23 00:29:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
IntGdiCombineRgn( pDC->prgnRao,
|
|
|
|
pDC->prgnVis,
|
|
|
|
pDC->prgnAPI,
|
2010-01-25 01:33:01 +00:00
|
|
|
RGN_AND );
|
|
|
|
|
|
|
|
RtlCopyMemory( &pDC->erclClip,
|
|
|
|
&((PROSRGNDATA)pDC->prgnRao)->rdh.rcBound,
|
|
|
|
sizeof(RECTL));
|
2008-05-23 00:29:08 +00:00
|
|
|
|
2009-03-20 01:35:49 +00:00
|
|
|
pDC->fs &= ~DC_FLAG_DIRTY_RAO;
|
2008-05-23 00:29:08 +00:00
|
|
|
|
2010-01-25 01:33:01 +00:00
|
|
|
IntGdiOffsetRgn(pDC->prgnRao, pDC->ptlDCOrig.x, pDC->ptlDCOrig.y);
|
|
|
|
|
|
|
|
// pDC->co should be used. Example, CLIPOBJ_cEnumStart uses XCLIPOBJ to build
|
|
|
|
// the rects from region objects rects in pClipRgn->Buffer.
|
|
|
|
// With pDC->co.pClipRgn->Buffer,
|
|
|
|
// pDC->co.pClipRgn = pDC->prgnRao ? pDC->prgnRao : pDC->prgnVis;
|
|
|
|
|
2008-05-23 00:29:08 +00:00
|
|
|
co = IntEngCreateClipRegion( ((PROSRGNDATA)pDC->prgnRao)->rdh.nCount,
|
2010-01-25 01:33:01 +00:00
|
|
|
((PROSRGNDATA)pDC->prgnRao)->Buffer,
|
|
|
|
&pDC->erclClip);
|
|
|
|
|
2010-05-25 11:41:29 +00:00
|
|
|
if (co)
|
|
|
|
{
|
|
|
|
if (pDC->rosdc.CombinedClip != NULL)
|
|
|
|
IntEngDeleteClipRegion(pDC->rosdc.CombinedClip);
|
|
|
|
|
|
|
|
pDC->rosdc.CombinedClip = co;
|
|
|
|
}
|
2008-05-23 00:29:08 +00:00
|
|
|
|
2010-01-25 01:33:01 +00:00
|
|
|
return IntGdiOffsetRgn(pDC->prgnRao, -pDC->ptlDCOrig.x, -pDC->ptlDCOrig.y);
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|