mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
proper implementation of FrameRgn() (cannot be ported from wine because wine's implementation is wrong)
svn path=/trunk/; revision=9211
This commit is contained in:
parent
d0983a67cd
commit
ed71de17e7
10 changed files with 151 additions and 41 deletions
|
@ -151,12 +151,5 @@ STDCALL
|
|||
NtGdiGetRegionData(HRGN hrgn,
|
||||
DWORD count,
|
||||
LPRGNDATA rgndata);
|
||||
|
||||
HRGN STDCALL REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, PPOINT lpPt);
|
||||
|
||||
HRGN FASTCALL UnsafeIntCreateRectRgnIndirect(CONST PRECT rc);
|
||||
INT FASTCALL UnsafeIntGetRgnBox(PROSRGNDATA Rgn, LPRECT pRect);
|
||||
VOID FASTCALL UnsafeIntUnionRectWithRgn(PROSRGNDATA RgnDest, CONST PRECT Rect);
|
||||
BOOL FASTCALL UnsafeIntRectInRegion(PROSRGNDATA Rgn, CONST LPRECT rc);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stubs.c,v 1.53 2004/04/23 13:34:04 weiden Exp $
|
||||
/* $Id: stubs.c,v 1.54 2004/04/24 14:21:36 weiden Exp $
|
||||
*
|
||||
* reactos/lib/gdi32/misc/stubs.c
|
||||
*
|
||||
|
@ -209,23 +209,6 @@ ExtCreateRegion(
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
FrameRgn(
|
||||
HDC a0,
|
||||
HRGN a1,
|
||||
HBRUSH a2,
|
||||
int a3,
|
||||
int a4
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
|
|
|
@ -309,3 +309,19 @@ InvertRgn(
|
|||
{
|
||||
return NtGdiInvertRgn(hDc, hRgn);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
FrameRgn(
|
||||
HDC hdc,
|
||||
HRGN hrgn,
|
||||
HBRUSH hbr,
|
||||
int nWidth,
|
||||
int nHeight
|
||||
)
|
||||
{
|
||||
return NtGdiFrameRgn(hdc, hrgn, hbr, nWidth, nHeight);
|
||||
}
|
||||
|
|
|
@ -100,6 +100,13 @@ int FASTCALL
|
|||
IntGdiGetClipBox(HDC hDC,
|
||||
LPRECT rc);
|
||||
|
||||
HRGN FASTCALL REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, PPOINT lpPt);
|
||||
|
||||
HRGN FASTCALL UnsafeIntCreateRectRgnIndirect(CONST PRECT rc);
|
||||
INT FASTCALL UnsafeIntGetRgnBox(PROSRGNDATA Rgn, LPRECT pRect);
|
||||
VOID FASTCALL UnsafeIntUnionRectWithRgn(PROSRGNDATA RgnDest, CONST PRECT Rect);
|
||||
BOOL FASTCALL UnsafeIntRectInRegion(PROSRGNDATA Rgn, CONST LPRECT rc);
|
||||
|
||||
/* DC functions */
|
||||
|
||||
BOOL FASTCALL
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: vis.c,v 1.26 2004/03/27 15:16:05 gvg Exp $
|
||||
* $Id: vis.c,v 1.27 2004/04/24 14:21:36 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -29,6 +29,7 @@
|
|||
#include <include/painting.h>
|
||||
#include <include/rect.h>
|
||||
#include <include/vis.h>
|
||||
#include <include/intgdi.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <win32k/debug1.h>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: window.c,v 1.219 2004/04/17 11:00:14 weiden Exp $
|
||||
/* $Id: window.c,v 1.220 2004/04/24 14:21:36 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -46,7 +46,7 @@
|
|||
#include <include/paint.h>
|
||||
#include <include/painting.h>
|
||||
#include <include/scroll.h>
|
||||
#include <include/vis.h>
|
||||
#include <include/intgdi.h>
|
||||
#include <include/menu.h>
|
||||
#include <include/hotkey.h>
|
||||
#include <include/focus.h>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: winpos.c,v 1.111 2004/04/14 17:19:38 weiden Exp $
|
||||
/* $Id: winpos.c,v 1.112 2004/04/24 14:21:36 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -44,6 +44,7 @@
|
|||
#include <include/painting.h>
|
||||
#include <include/dce.h>
|
||||
#include <include/vis.h>
|
||||
#include <include/intgdi.h>
|
||||
#include <include/focus.h>
|
||||
#include <include/tags.h>
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: cliprgn.c,v 1.31 2004/04/09 20:03:20 navaraf Exp $ */
|
||||
/* $Id: cliprgn.c,v 1.32 2004/04/24 14:21:37 weiden Exp $ */
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
@ -27,6 +27,7 @@
|
|||
#include <win32k/cliprgn.h>
|
||||
#include <win32k/coord.h>
|
||||
#include <include/error.h>
|
||||
#include <include/intgdi.h>
|
||||
#include "../eng/clip.h"
|
||||
|
||||
#define NDEBUG
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: path.c,v 1.19 2004/04/05 21:26:25 navaraf Exp $ */
|
||||
/* $Id: path.c,v 1.20 2004/04/24 14:21:37 weiden Exp $ */
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
@ -31,7 +31,6 @@
|
|||
#define _WIN32K_PATH_INTERNAL
|
||||
#include <include/object.h>
|
||||
#include <include/path.h>
|
||||
#include <include/intgdi.h>
|
||||
#include <include/tags.h>
|
||||
|
||||
#include <math.h>
|
||||
|
@ -45,6 +44,8 @@
|
|||
#define GROW_FACTOR_DENOM 1 /* Denominator of grow factor */
|
||||
|
||||
|
||||
INT FASTCALL
|
||||
IntGdiGetArcDirection(DC *dc);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: region.c,v 1.49 2004/04/23 13:34:04 weiden Exp $ */
|
||||
/* $Id: region.c,v 1.50 2004/04/24 14:21:37 weiden Exp $ */
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
@ -30,6 +30,7 @@
|
|||
#include <include/rect.h>
|
||||
#include <include/object.h>
|
||||
#include <include/inteng.h>
|
||||
#include <include/intgdi.h>
|
||||
#include <include/error.h>
|
||||
#include <include/tags.h>
|
||||
|
||||
|
@ -103,6 +104,7 @@ typedef struct _POINTBLOCK {
|
|||
struct _POINTBLOCK *next;
|
||||
} POINTBLOCK;
|
||||
|
||||
#ifndef NDEBUG
|
||||
/*
|
||||
* This function is left there for debugging purposes.
|
||||
*/
|
||||
|
@ -129,6 +131,7 @@ IntDumpRegion(HRGN hRgn)
|
|||
|
||||
RGNDATA_UnlockRgn(hRgn);
|
||||
}
|
||||
#endif /* NDEBUG */
|
||||
|
||||
static BOOL FASTCALL REGION_CopyRegion(PROSRGNDATA dst, PROSRGNDATA src)
|
||||
{
|
||||
|
@ -365,7 +368,7 @@ empty:
|
|||
*
|
||||
* \return hDst if success, 0 otherwise.
|
||||
*/
|
||||
HRGN STDCALL REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, PPOINT lpPt)
|
||||
HRGN FASTCALL REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, PPOINT lpPt)
|
||||
{
|
||||
PROSRGNDATA objSrc, rgnDst;
|
||||
HRGN hNewDst, hRet = NULL;
|
||||
|
@ -1413,7 +1416,99 @@ static void FASTCALL REGION_UnionRectWithRegion(const RECT *rect, ROSRGNDATA *rg
|
|||
}
|
||||
|
||||
|
||||
BOOL STDCALL REGION_LPTODP(HDC hdc, HRGN hDest, HRGN hSrc)
|
||||
BOOL FASTCALL REGION_CreateFrameRgn(HRGN hDest, HRGN hSrc, INT x, INT y)
|
||||
{
|
||||
PROSRGNDATA srcObj, destObj;
|
||||
PRECT rc;
|
||||
INT dx, dy;
|
||||
ULONG i;
|
||||
|
||||
if(!(srcObj = (PROSRGNDATA)RGNDATA_LockRgn(hSrc)))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if(!REGION_NOT_EMPTY(srcObj))
|
||||
{
|
||||
RGNDATA_UnlockRgn(hSrc);
|
||||
return FALSE;
|
||||
}
|
||||
if(!(destObj = (PROSRGNDATA)RGNDATA_LockRgn(hDest)))
|
||||
{
|
||||
RGNDATA_UnlockRgn(hSrc);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
EMPTY_REGION(destObj);
|
||||
if(!REGION_CopyRegion(destObj, srcObj))
|
||||
{
|
||||
RGNDATA_UnlockRgn(hDest);
|
||||
RGNDATA_UnlockRgn(hSrc);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* left-top */
|
||||
dx = x * 2;
|
||||
dy = y * 2;
|
||||
rc = (PRECT)srcObj->Buffer;
|
||||
for(i = 0; i < srcObj->rdh.nCount; i++)
|
||||
{
|
||||
rc->left += x;
|
||||
rc->top += y;
|
||||
rc->right += x;
|
||||
rc->bottom += y;
|
||||
rc++;
|
||||
}
|
||||
REGION_IntersectRegion(destObj, destObj, srcObj);
|
||||
|
||||
/* right-top */
|
||||
rc = (PRECT)srcObj->Buffer;
|
||||
for(i = 0; i < srcObj->rdh.nCount; i++)
|
||||
{
|
||||
rc->left -= dx;
|
||||
rc->right -= dx;
|
||||
rc++;
|
||||
}
|
||||
REGION_IntersectRegion(destObj, destObj, srcObj);
|
||||
|
||||
/* right-bottom */
|
||||
rc = (PRECT)srcObj->Buffer;
|
||||
for(i = 0; i < srcObj->rdh.nCount; i++)
|
||||
{
|
||||
rc->top -= dy;
|
||||
rc->bottom -= dy;
|
||||
rc++;
|
||||
}
|
||||
REGION_IntersectRegion(destObj, destObj, srcObj);
|
||||
|
||||
/* left-bottom */
|
||||
rc = (PRECT)srcObj->Buffer;
|
||||
for(i = 0; i < srcObj->rdh.nCount; i++)
|
||||
{
|
||||
rc->left += dx;
|
||||
rc->right += dx;
|
||||
rc++;
|
||||
}
|
||||
REGION_IntersectRegion(destObj, destObj, srcObj);
|
||||
|
||||
|
||||
rc = (PRECT)srcObj->Buffer;
|
||||
for(i = 0; i < srcObj->rdh.nCount; i++)
|
||||
{
|
||||
rc->left -= x;
|
||||
rc->top += y;
|
||||
rc->right -= x;
|
||||
rc->bottom += y;
|
||||
rc++;
|
||||
}
|
||||
REGION_SubtractRegion(destObj, srcObj, destObj);
|
||||
|
||||
RGNDATA_UnlockRgn(hDest);
|
||||
RGNDATA_UnlockRgn(hSrc);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOL FASTCALL REGION_LPTODP(HDC hdc, HRGN hDest, HRGN hSrc)
|
||||
{
|
||||
RECT *pCurRect, *pEndRect;
|
||||
PROSRGNDATA srcObj = NULL;
|
||||
|
@ -1893,13 +1988,25 @@ NtGdiFillRgn(HDC hDC, HRGN hRgn, HBRUSH hBrush)
|
|||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtGdiFrameRgn(HDC hDC,
|
||||
HRGN hRgn,
|
||||
HBRUSH hBrush,
|
||||
INT Width,
|
||||
INT Height)
|
||||
NtGdiFrameRgn(HDC hDC, HRGN hRgn, HBRUSH hBrush, INT Width, INT Height)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
HRGN FrameRgn;
|
||||
BOOL Ret;
|
||||
|
||||
if(!(FrameRgn = NtGdiCreateRectRgn(0, 0, 0, 0)))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if(!REGION_CreateFrameRgn(FrameRgn, hRgn, Width, Height))
|
||||
{
|
||||
NtGdiDeleteObject(FrameRgn);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Ret = NtGdiFillRgn(hDC, FrameRgn, hBrush);
|
||||
|
||||
NtGdiDeleteObject(FrameRgn);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
INT FASTCALL
|
||||
|
|
Loading…
Reference in a new issue