2003-05-18 17:16:18 +00:00
|
|
|
/*
|
2011-09-20 19:41:33 +00:00
|
|
|
* PROJECT: ReactOS win32 kernel mode subsystem
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
|
|
* FILE: subsystems/win32/win32k/objects/rect.c
|
|
|
|
* PURPOSE: Rect functions
|
|
|
|
* PROGRAMMER: Timo Kreuzer
|
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>
|
2002-07-04 20:12:28 +00:00
|
|
|
|
2005-06-29 07:09:25 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2002-07-04 20:12:28 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2009-03-19 01:42:34 +00:00
|
|
|
BOOL
|
|
|
|
FASTCALL
|
|
|
|
RECTL_bUnionRect(RECTL *prclDst, const RECTL *prcl1, const RECTL *prcl2)
|
2003-08-19 11:48:50 +00:00
|
|
|
{
|
2009-03-19 01:42:34 +00:00
|
|
|
if (RECTL_bIsEmptyRect(prcl1))
|
2004-11-15 23:10:42 +00:00
|
|
|
{
|
2009-03-19 01:42:34 +00:00
|
|
|
if (RECTL_bIsEmptyRect(prcl2))
|
|
|
|
{
|
|
|
|
RECTL_vSetEmptyRect(prclDst);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*prclDst = *prcl2;
|
|
|
|
}
|
2002-07-04 20:12:28 +00:00
|
|
|
}
|
2009-03-19 01:42:34 +00:00
|
|
|
else
|
2002-07-04 20:12:28 +00:00
|
|
|
{
|
2009-03-19 01:42:34 +00:00
|
|
|
if (RECTL_bIsEmptyRect(prcl2))
|
|
|
|
{
|
|
|
|
*prclDst = *prcl1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prclDst->left = min(prcl1->left, prcl2->left);
|
|
|
|
prclDst->top = min(prcl1->top, prcl2->top);
|
|
|
|
prclDst->right = max(prcl1->right, prcl2->right);
|
|
|
|
prclDst->bottom = max(prcl1->bottom, prcl2->bottom);
|
|
|
|
}
|
2002-07-04 20:12:28 +00:00
|
|
|
}
|
2004-11-15 23:10:42 +00:00
|
|
|
|
2009-03-19 01:42:34 +00:00
|
|
|
return TRUE;
|
2002-07-04 20:12:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-19 01:42:34 +00:00
|
|
|
BOOL
|
|
|
|
FASTCALL
|
2009-04-10 23:53:09 +00:00
|
|
|
RECTL_bIntersectRect(RECTL* prclDst, const RECTL* prcl1, const RECTL* prcl2)
|
2004-11-15 23:10:42 +00:00
|
|
|
{
|
2009-04-10 23:53:09 +00:00
|
|
|
prclDst->left = max(prcl1->left, prcl2->left);
|
|
|
|
prclDst->right = min(prcl1->right, prcl2->right);
|
|
|
|
|
|
|
|
if (prclDst->left < prclDst->right)
|
2002-07-04 20:12:28 +00:00
|
|
|
{
|
2009-04-10 23:53:09 +00:00
|
|
|
prclDst->top = max(prcl1->top, prcl2->top);
|
|
|
|
prclDst->bottom = min(prcl1->bottom, prcl2->bottom);
|
|
|
|
|
|
|
|
if (prclDst->top < prclDst->bottom)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
2002-07-04 20:12:28 +00:00
|
|
|
}
|
2004-11-15 23:10:42 +00:00
|
|
|
|
2009-04-10 23:53:09 +00:00
|
|
|
RECTL_vSetEmptyRect(prclDst);
|
2004-11-15 23:10:42 +00:00
|
|
|
|
2009-04-10 23:53:09 +00:00
|
|
|
return FALSE;
|
2004-11-15 23:10:42 +00:00
|
|
|
}
|
|
|
|
|
2009-04-13 21:38:37 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
RECTL_vMakeWellOrdered(RECTL *prcl)
|
|
|
|
{
|
|
|
|
LONG lTmp;
|
|
|
|
if (prcl->left > prcl->right)
|
|
|
|
{
|
|
|
|
lTmp = prcl->left;
|
|
|
|
prcl->left = prcl->right;
|
|
|
|
prcl->right = lTmp;
|
|
|
|
}
|
|
|
|
if (prcl->top > prcl->bottom)
|
|
|
|
{
|
|
|
|
lTmp = prcl->top;
|
|
|
|
prcl->top = prcl->bottom;
|
|
|
|
prcl->bottom = lTmp;
|
|
|
|
}
|
|
|
|
}
|
2004-11-15 23:10:42 +00:00
|
|
|
|
2010-05-18 09:01:08 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
RECTL_vInflateRect(RECTL *rect, INT dx, INT dy)
|
|
|
|
{
|
|
|
|
rect->left -= dx;
|
|
|
|
rect->top -= dy;
|
|
|
|
rect->right += dx;
|
|
|
|
rect->bottom += dy;
|
|
|
|
}
|
2009-03-19 01:42:34 +00:00
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|