ReactOS 0.4.15-dev-7788-g1ad9096
region.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _REGION
 

Macros

#define IntSysCreateRectpRgnIndirect(prc)    IntSysCreateRectpRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom)
 
#define GreCreateRectRgnIndirect(prc)    NtGdiCreateRectRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom)
 
#define GreSetRectRgnIndirect(hRgn, prc)    NtGdiSetRectRgn(hRgn, (prc)->left, (prc)->top, (prc)->right, (prc)->bottom);
 

Typedefs

typedef struct _REGION REGION
 
typedef struct _REGIONPREGION
 

Functions

PREGION FASTCALL REGION_AllocRgnWithHandle (INT n)
 
PREGION FASTCALL REGION_AllocUserRgnWithHandle (INT n)
 
BOOL FASTCALL REGION_UnionRectWithRgn (PREGION rgn, const RECTL *rect)
 
INT FASTCALL REGION_SubtractRectFromRgn (PREGION prgnDest, PREGION prgnSrc, const RECTL *prcl)
 
INT FASTCALL REGION_GetRgnBox (PREGION Rgn, RECTL *pRect)
 
BOOL FASTCALL REGION_RectInRegion (PREGION Rgn, const RECTL *rc)
 
BOOL FASTCALL REGION_PtInRegion (PREGION, INT, INT)
 
INT FASTCALL REGION_CropRegion (PREGION rgnDst, PREGION rgnSrc, const RECTL *rect)
 
VOID FASTCALL REGION_SetRectRgn (PREGION pRgn, INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
 
VOID NTAPI REGION_vCleanup (PVOID ObjectBody)
 
VOID FASTCALL REGION_Delete (PREGION)
 
INT APIENTRY IntGdiGetRgnBox (HRGN, RECTL *)
 
PREGION FASTCALL REGION_LockRgn (_In_ HRGN hrgn)
 
VOID FASTCALL REGION_UnlockRgn (_In_ PREGION prgn)
 
BOOL FASTCALL REGION_bXformRgn (_Inout_ PREGION prgn, _In_ PMATRIX pmx)
 
BOOL FASTCALL REGION_SetPolyPolygonRgn (_Inout_ PREGION prgn, _In_ const POINT *ppt, _In_ const ULONG *pcPoints, _In_ ULONG cPolygons, _In_ INT iMode)
 
HRGN NTAPI GreCreatePolyPolygonRgn (_In_ const POINT *ppt, _In_ const ULONG *pcPoints, _In_ ULONG cPolygons, _In_ INT iMode)
 
BOOL FASTCALL REGION_bOffsetRgn (_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
 
BOOL FASTCALL IntRectInRegion (HRGN, LPRECTL)
 
INT FASTCALL IntGdiCombineRgn (PREGION, PREGION, PREGION, INT)
 
INT FASTCALL REGION_Complexity (PREGION)
 
PREGION FASTCALL IntSysCreateRectpRgn (INT, INT, INT, INT)
 
BOOL FASTCALL IntGdiSetRegionOwner (HRGN, DWORD)
 
HRGN FASTCALL GreCreateFrameRgn (HRGN hrgn, INT x, INT y)
 

Variables

PREGION prgnDefault
 
HRGN hrgnDefault
 

Macro Definition Documentation

◆ GreCreateRectRgnIndirect

#define GreCreateRectRgnIndirect (   prc)     NtGdiCreateRectRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom)

Definition at line 96 of file region.h.

◆ GreSetRectRgnIndirect

#define GreSetRectRgnIndirect (   hRgn,
  prc 
)     NtGdiSetRectRgn(hRgn, (prc)->left, (prc)->top, (prc)->right, (prc)->bottom);

Definition at line 99 of file region.h.

◆ IntSysCreateRectpRgnIndirect

#define IntSysCreateRectpRgnIndirect (   prc)     IntSysCreateRectpRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom)

Definition at line 93 of file region.h.

Typedef Documentation

◆ PREGION

typedef struct _REGION * PREGION

◆ REGION

Function Documentation

◆ GreCreateFrameRgn()

HRGN FASTCALL GreCreateFrameRgn ( HRGN  hrgn,
INT  x,
INT  y 
)

Definition at line 2025 of file region.c.

2032{
2033 PREGION prgnFrame, prgnSrc;
2034 HRGN hrgnFrame;
2035
2036 /* Allocate a new region */
2037 prgnFrame = REGION_AllocUserRgnWithHandle(1);
2038 if (prgnFrame == NULL)
2039 {
2041 return NULL;
2042 }
2043
2044 /* Lock the source region */
2045 prgnSrc = REGION_LockRgn(hrgn);
2046 if (prgnSrc == NULL)
2047 {
2048 REGION_Delete(prgnFrame);
2049 return FALSE;
2050 }
2051
2052 if (REGION_bMakeFrameRegion(prgnFrame, prgnSrc, cx, cy))
2053 {
2054 hrgnFrame = prgnFrame->BaseObject.hHmgr;
2055 REGION_UnlockRgn(prgnFrame);
2056 }
2057 else
2058 {
2059 REGION_Delete(prgnFrame);
2060 hrgnFrame = NULL;
2061 }
2062
static HRGN hrgn
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
Definition: region.h:8
BASEOBJECT BaseObject
Definition: region.h:11
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2449
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2358
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2373
PREGION FASTCALL REGION_AllocUserRgnWithHandle(INT nRgn)
Definition: region.c:2294
static BOOL REGION_bMakeFrameRegion(_Inout_ PREGION prgnDest, _Inout_ PREGION prgnSrc, _In_ INT cx, _In_ INT cy)
Definition: region.c:1940
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22

Referenced by NtGdiFrameRgn().

◆ GreCreatePolyPolygonRgn()

HRGN NTAPI GreCreatePolyPolygonRgn ( _In_ const POINT ppt,
_In_ const ULONG pcPoints,
_In_ ULONG  cPolygons,
_In_ INT  iMode 
)

Definition at line 3452 of file region.c.

3460{
3461 PREGION prgn;
3462 HRGN hrgn;
3463
3464 /* Allocate a new region */
3466 if (prgn == NULL)
3467 {
3469 return NULL;
3470 }
3471
3472 /* Call the internal function and check for success */
3473 if (REGION_SetPolyPolygonRgn(prgn, ppt, pcPoints, cPolygons, iMode))
3474 {
3475 /* Success, get the handle and unlock the region */
3476 hrgn = prgn->BaseObject.hHmgr;
3477 REGION_UnlockRgn(prgn);
3478 }
3479 else
3480 {
3481 /* Failure, delete the region */
3482 REGION_Delete(prgn);
3483 hrgn = NULL;
3484 }
BOOL FASTCALL REGION_SetPolyPolygonRgn(_Inout_ PREGION prgn, _In_ const POINT *ppt, _In_ const ULONG *pcPoints, _In_ ULONG cPolygons, _In_ INT iMode)
Definition: region.c:3254
_In_ ULONG iMode
Definition: winddi.h:3520

Referenced by NtGdiPolyPolyDraw().

◆ IntGdiCombineRgn()

INT FASTCALL IntGdiCombineRgn ( PREGION  prgnDest,
PREGION  prgnSrc1,
PREGION  prgnSrc2,
INT  iCombineMode 
)

Definition at line 2487 of file region.c.

2495{
2496 BOOL Ret = TRUE;
2497
2498 if (prgnDest == NULL)
2499 {
2500 DPRINT("IntGdiCombineRgn: hDest unavailable\n");
2501 return ERROR;
2502 }
2503
2504 if (prgnSrc1 == NULL)
2505 {
2506 DPRINT("IntGdiCombineRgn: hSrc1 unavailable\n");
2507 return ERROR;
2508 }
2509
2510 if (iCombineMode == RGN_COPY)
2511 {
2512 if (!REGION_CopyRegion(prgnDest, prgnSrc1))
2513 return ERROR;
2514
2515 return REGION_Complexity(prgnDest);
2516 }
2517
2518 if (prgnSrc2 == NULL)
2519 {
2520 DPRINT1("IntGdiCombineRgn requires hSrc2 != NULL for combine mode %d!\n", iCombineMode);
2521 ASSERT(FALSE);
2522 return ERROR;
2523 }
2524
2525 switch (iCombineMode)
2526 {
2527 case RGN_AND:
2528 Ret = REGION_IntersectRegion(prgnDest, prgnSrc1, prgnSrc2);
2529 break;
2530 case RGN_OR:
2531 Ret = REGION_UnionRegion(prgnDest, prgnSrc1, prgnSrc2);
2532 break;
2533 case RGN_XOR:
2534 Ret = REGION_XorRegion(prgnDest, prgnSrc1, prgnSrc2);
2535 break;
2536 case RGN_DIFF:
2537 Ret = REGION_SubtractRegion(prgnDest, prgnSrc1, prgnSrc2);
2538 break;
2539 }
#define DPRINT1
Definition: precomp.h:8
#define TRUE
Definition: types.h:120
#define ERROR(name)
Definition: error_private.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ASSERT(a)
Definition: mode.c:44
#define DPRINT
Definition: sndvol32.h:71
INT FASTCALL REGION_Complexity(PREGION prgn)
Definition: region.c:554
static BOOL FASTCALL REGION_UnionRegion(PREGION newReg, PREGION reg1, PREGION reg2)
Definition: region.c:1464
static BOOL FASTCALL REGION_XorRegion(PREGION dr, PREGION sra, PREGION srb)
Definition: region.c:1753
static BOOL FASTCALL REGION_IntersectRegion(PREGION newReg, PREGION reg1, PREGION reg2)
Definition: region.c:1292
static BOOL FASTCALL REGION_SubtractRegion(PREGION regD, PREGION regM, PREGION regS)
Definition: region.c:1717
static BOOL FASTCALL REGION_CopyRegion(PREGION dst, PREGION src)
Definition: region.c:574
#define RGN_DIFF
Definition: wingdi.h:358
#define RGN_COPY
Definition: wingdi.h:357
#define RGN_AND
Definition: wingdi.h:356
#define RGN_XOR
Definition: wingdi.h:360
#define RGN_OR
Definition: wingdi.h:359

Referenced by _Success_(), co_IntGetUpdateRgn(), co_UserRedrawWindow(), co_VIS_WindowLayoutChanged(), co_WinPosSetWindowPos(), DC_vCopyState(), DceUpdateVisRgn(), ForceNCPaintErase(), IntGdiBitBltRgn(), IntGdiFillRgn(), IntInvalidateWindows(), IntScrollWindowEx(), IntValidateParents(), NtGdiCombineRgn(), NtGdiGetRandomRgn(), REGION_LPTODP(), UserScrollDC(), and VIS_ComputeVisibleRegion().

◆ IntGdiGetRgnBox()

INT APIENTRY IntGdiGetRgnBox ( HRGN  ,
RECTL  
)

◆ IntGdiSetRegionOwner()

BOOL FASTCALL IntGdiSetRegionOwner ( HRGN  hRgn,
DWORD  OwnerMask 
)

Definition at line 2459 of file region.c.

2463{
2464 PREGION prgn;
2465 PRGN_ATTR prgnattr;
2466 PPROCESSINFO ppi;
2467
2468 prgn = REGION_LockRgn(hRgn);
2469 if (prgn == NULL)
2470 {
2471 return FALSE;
2472 }
2473
2474 prgnattr = prgn->prgnattr;
2475 if (prgnattr != &prgn->rgnattr)
2476 {
2478 prgn->prgnattr = &prgn->rgnattr;
2480 GdiPoolFree(ppi->pPoolRgnAttr, prgnattr);
2481 }
2482
2483 REGION_UnlockRgn(prgn);
VOID NTAPI GdiPoolFree(PGDI_POOL pPool, PVOID pvAlloc)
Definition: gdipool.c:233
static HRGN hRgn
Definition: mapping.c:33
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
struct _GDI_POOL * pPoolRgnAttr
Definition: win32.h:293
RGN_ATTR rgnattr
Definition: region.h:13
_Notnull_ PRGN_ATTR prgnattr
Definition: region.h:12
VOID NTAPI GDIOBJ_vSetObjectAttr(POBJ pobj, PVOID pvObjAttr)
Definition: gdiobj.c:1096

Referenced by co_UserFreeWindow(), ForceNCPaintErase(), IntBeginPaint(), IntGetNCUpdateRgn(), IntInvalidateWindows(), SelectWindowRgn(), and UserUpdateMonitorSize().

◆ IntRectInRegion()

BOOL FASTCALL IntRectInRegion ( HRGN  hRgn,
LPRECTL  rc 
)

Definition at line 3488 of file region.c.

3494{
3495 PREGION Rgn;
3496 BOOL Ret;
3497
3498 Rgn = REGION_LockRgn(hRgn);
3499 if (Rgn == NULL)
3500 {
3501 return ERROR;
3502 }
3503
3504 Ret = REGION_RectInRegion(Rgn, rc);
BOOL FASTCALL REGION_RectInRegion(PREGION Rgn, const RECTL *rect)
Definition: region.c:2605

Referenced by NtGdiRectInRegion().

◆ IntSysCreateRectpRgn()

PREGION FASTCALL IntSysCreateRectpRgn ( INT  LeftRect,
INT  TopRect,
INT  RightRect,
INT  BottomRect 
)

Definition at line 2407 of file region.c.

2415{
2416 PREGION prgn;
2417
2418 /* Allocate a region, without a handle */
2420 if (prgn == NULL)
2421 {
2422 return NULL;
2423 }
2424
2425 /* Initialize it */
2426 prgn->Buffer = &prgn->rdh.rcBound;
2427 prgn->prgnattr = &prgn->rgnattr;
2429 REGION_SetRectRgn(prgn, LeftRect, TopRect, RightRect, BottomRect);
@ BASEFLAG_LOOKASIDE
Definition: gdiobj.h:58
#define ATTR_RGN_VALID
Definition: ntgdihdl.h:195
@ GDIObjType_RGN_TYPE
Definition: ntgdityp.h:124
struct _REGION * PREGION
RECTL * Buffer
Definition: region.h:16
RGNDATAHEADER rdh
Definition: region.h:15
ULONG AttrFlags
Definition: ntgdihdl.h:256
POBJ NTAPI GDIOBJ_AllocateObject(UCHAR objt, ULONG cjSize, FLONG fl)
Definition: gdiobj.c:562
VOID FASTCALL REGION_SetRectRgn(PREGION rgn, INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2665

Referenced by _Success_(), CLIPPING_UpdateGCRegion(), co_UserRedrawWindow(), co_VIS_WindowLayoutChanged(), co_WinPosSetWindowPos(), DC_InitHack(), DC_vCopyState(), DC_vInitDc(), DC_vUpdateDC(), DceGetVisRgn(), DceUpdateVisRgn(), IntGdiBitBltRgn(), IntGdiFillRgn(), IntGdiSetMetaRgn(), IntInvalidateWindows(), IntScrollWindowEx(), IntSetDefaultRegion(), NtGdiSelectClipPath(), and PATH_FillPathEx().

◆ REGION_AllocRgnWithHandle()

PREGION FASTCALL REGION_AllocRgnWithHandle ( INT  n)

Definition at line 2201 of file region.c.

2206{
2207 //HRGN hReg;
2208 PREGION pReg;
2209
2211 sizeof(REGION),
2213 if (pReg == NULL)
2214 {
2215 DPRINT1("Could not allocate a palette.\n");
2216 return NULL;
2217 }
2218
2219 //hReg = pReg->BaseObject.hHmgr;
2220
2221 if ((nReg == 0) || (nReg == 1))
2222 {
2223 /* Testing shows that > 95% of all regions have only 1 rect.
2224 Including that here saves us from having to do another allocation */
2225 pReg->Buffer = &pReg->rdh.rcBound;
2226 }
2227 else
2228 {
2230 nReg * sizeof(RECT),
2231 TAG_REGION);
2232 if (pReg->Buffer == NULL)
2233 {
2234 DPRINT1("Could not allocate region buffer\n");
2236 return NULL;
2237 }
2238 }
2239
2240 EMPTY_REGION(pReg);
2241 pReg->rdh.dwSize = sizeof(RGNDATAHEADER);
2242 pReg->rdh.nCount = nReg;
2243 pReg->rdh.nRgnSize = nReg * sizeof(RECT);
2244 pReg->prgnattr = &pReg->rgnattr;
2245
2246 /* Initialize the region attribute */
2247 pReg->rgnattr.AttrFlags = 0;
2249 pReg->rgnattr.Rect = pReg->rdh.rcBound;
2250
2251 /* Finally insert the region into the handle table */
2253 {
2254 DPRINT1("Could not insert palette into handle table.\n");
2256 return NULL;
2257 }
struct _RGNDATAHEADER RGNDATAHEADER
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
ULONG iComplexity
Definition: ntgdihdl.h:257
RECTL Rect
Definition: ntgdihdl.h:258
#define RECT
Definition: precomp.h:26
VOID NTAPI GDIOBJ_vFreeObject(POBJ pobj)
Definition: gdiobj.c:596
HGDIOBJ NTAPI GDIOBJ_hInsertObject(POBJ pobj, ULONG ulOwner)
Definition: gdiobj.c:912
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1111
#define EMPTY_REGION(pReg)
Definition: region.c:148
#define TAG_REGION
Definition: tags.h:22
#define SIMPLEREGION
Definition: wingdi.h:362

Referenced by REGION_AllocUserRgnWithHandle(), and REGION_XorRegion().

◆ REGION_AllocUserRgnWithHandle()

PREGION FASTCALL REGION_AllocUserRgnWithHandle ( INT  n)

Definition at line 2294 of file region.c.

2299{
2300 PREGION prgn;
2301
2302 prgn = REGION_AllocRgnWithHandle(nRgn);
2303 if (prgn == NULL)
2304 {
2305 return NULL;
2306 }
2307
2308 if (!REGION_bAllocRgnAttr(prgn))
2309 {
2310 ASSERT(FALSE);
2311 }
BOOL NTAPI REGION_bAllocRgnAttr(PREGION prgn)
Definition: region.c:2261
PREGION FASTCALL REGION_AllocRgnWithHandle(INT nReg)
Definition: region.c:2201

Referenced by GreCreateFrameRgn(), GreCreatePolyPolygonRgn(), NtGdiCreateRectRgn(), NtGdiCreateRoundRectRgn(), NtGdiExtCreateRegion(), and NtGdiPathToRegion().

◆ REGION_bOffsetRgn()

BOOL FASTCALL REGION_bOffsetRgn ( _Inout_ PREGION  prgn,
_In_ INT  cx,
_In_ INT  cy 
)

Definition at line 2707 of file region.c.

2714{
2715 PRECTL prcl;
2716 UINT i;
2717
2718 NT_ASSERT(prgn != NULL);
2719
2720 /* Check for trivial case */
2721 if ((cx == 0) && (cy == 0))
2722 {
2723 return TRUE;
2724 }
2725
2726 /* Check for empty regions, we ignore the offset values here */
2727 if (prgn->rdh.nCount == 0)
2728 {
2729 return TRUE;
2730 }
2731
2732 /* Make sure the offset is within the legal range */
2733 if ((cx > MAX_COORD) || (cx < MIN_COORD) ||
2734 (cy > MAX_COORD) || (cy < MIN_COORD))
2735 {
2736 return FALSE;
2737 }
2738
2739 /* Are we moving right? */
2740 if (cx > 0)
2741 {
2742 /* Check if we stay inside the bounds on the right side */
2743 if (prgn->rdh.rcBound.right > (MAX_COORD - cx))
2744 {
2745 return FALSE;
2746 }
2747 }
2748 else
2749 {
2750 /* Check if we stay inside the bounds on the left side */
2751 if (prgn->rdh.rcBound.left < (MIN_COORD - cx))
2752 {
2753 return FALSE;
2754 }
2755 }
2756
2757 /* Are we moving down? */
2758 if (cy > 0)
2759 {
2760 /* Check if we stay inside the bounds on the right side */
2761 if (prgn->rdh.rcBound.bottom > (MAX_COORD - cy))
2762 {
2763 return FALSE;
2764 }
2765 }
2766 else
2767 {
2768 /* Check if we stay inside the bounds on the left side */
2769 if (prgn->rdh.rcBound.top < (MIN_COORD - cy))
2770 {
2771 return FALSE;
2772 }
2773 }
2774
2775 /* Loop to move the rects */
2776 prcl = prgn->Buffer;
2777 for (i = 0; i < prgn->rdh.nCount; i++)
2778 {
2779 prcl[i].left += cx;
2780 prcl[i].right += cx;
2781 prcl[i].top += cy;
2782 prcl[i].bottom += cy;
2783 }
2784
2785 /* Finally update the bounds rect */
2786 if (prgn->Buffer != &prgn->rdh.rcBound)
2787 {
2788 prgn->rdh.rcBound.left += cx;
2789 prgn->rdh.rcBound.right += cx;
2790 prgn->rdh.rcBound.top += cy;
2791 prgn->rdh.rcBound.bottom += cy;
2792 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
#define MAX_COORD
Definition: region.c:12
#define MIN_COORD
Definition: region.c:11
_In_ ULONG _In_ CLIPOBJ _In_ RECTL * prcl
Definition: winddi.h:3531
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Referenced by CLIPPING_UpdateGCRegion(), co_IntGetUpdateRgn(), co_UserRedrawWindow(), co_VIS_WindowLayoutChanged(), co_WinPosSetWindowPos(), DceResetActiveDCEs(), GdiSelectVisRgn(), IntGdiBitBltRgn(), IntGdiFillRgn(), IntInvalidateWindows(), IntScrollWindowEx(), NtGdiGetRandomRgn(), NtGdiOffsetClipRgn(), NtGdiOffsetRgn(), REGION_bMakeFrameRegion(), REGION_bXformRgn(), UserScrollDC(), and VIS_ComputeVisibleRegion().

◆ REGION_bXformRgn()

BOOL FASTCALL REGION_bXformRgn ( _Inout_ PREGION  prgn,
_In_ PMATRIX  pmx 
)

Definition at line 2066 of file region.c.

2072{
2073 XFORMOBJ xo;
2074 ULONG i, cjSize;
2075 PPOINT ppt;
2076 PULONG pcPoints;
2077 RECT rect;
2078 BOOL bResult;
2079
2080 /* Check for zero rectangles and return TRUE for translation only matrices */
2081 if (prgn->rdh.nCount < 1)
2082 return (pmx->flAccel & XFORM_UNITY) != 0;
2083
2084 /* Check if this is a scaling only matrix (off-diagonal elements are 0 */
2085 if (pmx->flAccel & XFORM_SCALE)
2086 {
2087 /* Check if this is a translation only matrix */
2088 if (pmx->flAccel & XFORM_UNITY)
2089 {
2090 /* Just offset the region */
2091 return REGION_bOffsetRgn(prgn, (pmx->fxDx + 8) / 16, (pmx->fxDy + 8) / 16);
2092 }
2093 else
2094 {
2095 /* Initialize the xform object */
2096 XFORMOBJ_vInit(&xo, pmx);
2097
2098 /* Scaling can move the rects out of the coordinate space, so
2099 * we first need to check whether we can apply the transformation
2100 * on the bounds rect without modifying the region */
2101 if (!XFORMOBJ_bApplyXform(&xo, XF_LTOL, 2, &prgn->rdh.rcBound, &rect))
2102 {
2103 return FALSE;
2104 }
2105
2106 /* Apply the xform to the rects in the region */
2107 if (!XFORMOBJ_bApplyXform(&xo,
2108 XF_LTOL,
2109 prgn->rdh.nCount * 2,
2110 prgn->Buffer,
2111 prgn->Buffer))
2112 {
2113 /* This can not happen, since we already checked the bounds! */
2115 }
2116
2117 /* Reset bounds */
2118 RECTL_vSetEmptyRect(&prgn->rdh.rcBound);
2119
2120 /* Loop all rects in the region */
2121 for (i = 0; i < prgn->rdh.nCount; i++)
2122 {
2123 /* Make sure the rect is well-ordered after the xform */
2124 RECTL_vMakeWellOrdered(&prgn->Buffer[i]);
2125
2126 /* Update bounds */
2127 if (!RECTL_bUnionRect(&prgn->rdh.rcBound,
2128 &prgn->rdh.rcBound,
2129 &prgn->Buffer[i]))
2130 {
2131 DPRINT1("NULL Set in Union Rects\n");
2132 return FALSE;
2133 }
2134 }
2135
2136 /* Loop all rects in the region */
2137 for (i = 0; i < prgn->rdh.nCount - 1; i++)
2138 {
2139 NT_ASSERT(prgn->Buffer[i].top <= prgn->Buffer[i].bottom);
2140 NT_ASSERT(prgn->Buffer[i + 1].top >= prgn->Buffer[i].top);
2141 }
2142
2143 return TRUE;
2144 }
2145 }
2146 else
2147 {
2148 /* Allocate a buffer for the polygons */
2149 cjSize = prgn->rdh.nCount * (4 * sizeof(POINT) + sizeof(ULONG));
2151 if (ppt == NULL)
2152 {
2153 return FALSE;
2154 }
2155
2156 /* Fill the buffer with the rects */
2157 pcPoints = (PULONG)&ppt[4 * prgn->rdh.nCount];
2158 for (i = 0; i < prgn->rdh.nCount; i++)
2159 {
2160 /* Make sure the rect is within the legal range */
2161 pcPoints[i] = 4;
2162 ppt[4 * i + 0].x = prgn->Buffer[i].left;
2163 ppt[4 * i + 0].y = prgn->Buffer[i].top;
2164 ppt[4 * i + 1].x = prgn->Buffer[i].right;
2165 ppt[4 * i + 1].y = prgn->Buffer[i].top;
2166 ppt[4 * i + 2].x = prgn->Buffer[i].right;
2167 ppt[4 * i + 2].y = prgn->Buffer[i].bottom;
2168 ppt[4 * i + 3].x = prgn->Buffer[i].left;
2169 ppt[4 * i + 3].y = prgn->Buffer[i].bottom;
2170 }
2171
2172 /* Initialize the xform object */
2173 XFORMOBJ_vInit(&xo, pmx);
2174
2175 /* Apply the xform to the rects in the buffer */
2176 if (!XFORMOBJ_bApplyXform(&xo,
2177 XF_LTOL,
2178 prgn->rdh.nCount * 2,
2179 ppt,
2180 ppt))
2181 {
2182 /* This means, there were coordinates that would go outside of
2183 the coordinate space after the transformation */
2185 return FALSE;
2186 }
2187
2188 /* Now use the polygons to create a polygon region */
2189 bResult = REGION_SetPolyPolygonRgn(prgn,
2190 ppt,
2191 pcPoints,
2192 prgn->rdh.nCount,
2193 WINDING);
2194
2195 /* Free the polygon buffer */
2197
#define WINDING
Definition: constants.h:279
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define for
Definition: utility.h:88
@ XFORM_SCALE
Definition: ntgdityp.h:106
@ XFORM_UNITY
Definition: ntgdityp.h:107
& rect
Definition: startmenu.cpp:1413
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
uint32_t * PULONG
Definition: typedefs.h:59
uint32_t ULONG
Definition: typedefs.h:59
#define POINT
Definition: precomp.h:30
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
BOOL FASTCALL RECTL_bUnionRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:18
FORCEINLINE VOID RECTL_vSetEmptyRect(_Out_ RECTL *prcl)
Definition: rect.h:20
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2707
#define GDITAG_REGION
Definition: tags.h:158
#define XF_LTOL
Definition: winddi.h:3109
_In_ ULONG cjSize
Definition: winddi.h:3634
#define XFORMOBJ_vInit
Definition: xformobj.h:12
#define XFORMOBJ_bApplyXform
Definition: xformobj.h:11

Referenced by REGION_LPTODP().

◆ REGION_Complexity()

INT FASTCALL REGION_Complexity ( PREGION  prgn)

Definition at line 554 of file region.c.

558{
559 if (prgn == NULL)
560 return NULLREGION;
561
562 DPRINT("Region Complexity: %lu\n", prgn->rdh.nCount);
563 switch (prgn->rdh.nCount)
564 {
565 case 0:
566 return NULLREGION;
567 case 1:
568 return SIMPLEREGION;
569 default:
#define NULLREGION
Definition: wingdi.h:361

Referenced by _Success_(), co_WinPosSetWindowPos(), DxEngGetDCState(), IntGdiCombineRgn(), IntGdiSetMetaRgn(), NtGdiOffsetClipRgn(), NtGdiOffsetRgn(), REGION_bMakeFrameRegion(), REGION_CropRegion(), REGION_GetRgnBox(), REGION_SubtractRectFromRgn(), and REGION_UnlockRgn().

◆ REGION_CropRegion()

INT FASTCALL REGION_CropRegion ( PREGION  rgnDst,
PREGION  rgnSrc,
const RECTL rect 
)

Definition at line 665 of file region.c.

672{
673 PRECTL lpr, rpr;
674 ULONG i, j, clipa, clipb, nRgnSize;
675 INT left = MAXLONG;
676 INT right = MINLONG;
677 INT top = MAXLONG;
679
680 if ((rect->left >= rect->right) ||
681 (rect->top >= rect->bottom) ||
682 (EXTENTCHECK(rect, &rgnSrc->rdh.rcBound) == 0))
683 {
684 goto empty;
685 }
686
687 /* Skip all rects that are completely above our intersect rect */
688 for (clipa = 0; clipa < rgnSrc->rdh.nCount; clipa++)
689 {
690 /* bottom is exclusive, so break when we go above it */
691 if (rgnSrc->Buffer[clipa].bottom > rect->top) break;
692 }
693
694 /* Bail out, if there is nothing left */
695 if (clipa == rgnSrc->rdh.nCount) goto empty;
696
697 /* Find the last rect that is still within the intersect rect (exclusive) */
698 for (clipb = clipa; clipb < rgnSrc->rdh.nCount; clipb++)
699 {
700 /* bottom is exclusive, so stop, when we start at that y pos */
701 if (rgnSrc->Buffer[clipb].top >= rect->bottom) break;
702 }
703
704 /* Bail out, if there is nothing left */
705 if (clipb == clipa) goto empty;
706
707 // clipa - index of the first rect in the first intersecting band
708 // clipb - index of the last rect in the last intersecting band plus 1
709
710 /* Check if the buffer in the dest region is large enough,
711 otherwise allocate a new one */
712 nRgnSize = (clipb - clipa) * sizeof(RECT);
713 if ((rgnDst != rgnSrc) && (rgnDst->rdh.nRgnSize < nRgnSize))
714 {
715 PRECTL temp;
717 if (temp == NULL)
718 return ERROR;
719
720 /* Free the old buffer */
721 if (rgnDst->Buffer && (rgnDst->Buffer != &rgnDst->rdh.rcBound))
723
724 rgnDst->Buffer = temp;
725 rgnDst->rdh.nCount = 0;
726 rgnDst->rdh.nRgnSize = nRgnSize;
727 rgnDst->rdh.iType = RDH_RECTANGLES;
728 }
729
730 /* Loop all rects within the intersect rect from the y perspective */
731 for (i = clipa, j = 0; i < clipb ; i++)
732 {
733 /* i - src index, j - dst index, j is always <= i for obvious reasons */
734
735 lpr = &rgnSrc->Buffer[i];
736
737 /* Make sure the source rect is not retarded */
738 ASSERT(lpr->bottom > lpr->top);
739 ASSERT(lpr->right > lpr->left);
740
741 /* We already checked above, this should hold true */
742 ASSERT(lpr->bottom > rect->top);
743 ASSERT(lpr->top < rect->bottom);
744
745 /* Check if this rect is really inside the intersect rect */
746 if ((lpr->left < rect->right) && (lpr->right > rect->left))
747 {
748 rpr = &rgnDst->Buffer[j];
749
750 /* Crop the rect with the intersect rect */
751 rpr->top = max(lpr->top, rect->top);
752 rpr->bottom = min(lpr->bottom, rect->bottom);
753 rpr->left = max(lpr->left, rect->left);
754 rpr->right = min(lpr->right, rect->right);
755
756 /* Make sure the resulting rect is not retarded */
757 ASSERT(rpr->bottom > rpr->top);
758 ASSERT(rpr->right > rpr->left);
759
760 /* Track new bounds */
761 if (rpr->left < left) left = rpr->left;
762 if (rpr->right > right) right = rpr->right;
763 if (rpr->top < top) top = rpr->top;
764 if (rpr->bottom > bottom) bottom = rpr->bottom;
765
766 /* Next target rect */
767 j++;
768 }
769 }
770
771 if (j == 0) goto empty;
772
773 /* Update the bounds rect */
774 rgnDst->rdh.rcBound.left = left;
775 rgnDst->rdh.rcBound.right = right;
776 rgnDst->rdh.rcBound.top = top;
777 rgnDst->rdh.rcBound.bottom = bottom;
778
779 /* Set new rect count */
780 rgnDst->rdh.nCount = j;
781
782 return REGION_Complexity(rgnDst);
783
784empty:
785 if (rgnDst->Buffer == NULL)
786 {
787 rgnDst->Buffer = &rgnDst->rdh.rcBound;
788 }
789
static const WCHAR empty[]
Definition: main.c:47
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define min(a, b)
Definition: monoChain.cc:55
static calc_node_t temp
Definition: rpn_ieee.c:38
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define max(a, b)
Definition: svc.c:63
int32_t INT
Definition: typedefs.h:58
#define MAXLONG
Definition: umtypes.h:116
#define MINLONG
Definition: umtypes.h:115
#define EXTENTCHECK(r1, r2)
Definition: region.c:166
#define RDH_RECTANGLES
Definition: wingdi.h:669

◆ REGION_Delete()

◆ REGION_GetRgnBox()

INT FASTCALL REGION_GetRgnBox ( PREGION  Rgn,
RECTL pRect 
)

◆ REGION_LockRgn()

◆ REGION_PtInRegion()

BOOL FASTCALL REGION_PtInRegion ( PREGION  prgn,
INT  X,
INT  Y 
)

Definition at line 2582 of file region.c.

2589{
2590 ULONG i;
2591 PRECT r;
2592
2593 if (prgn->rdh.nCount > 0 && INRECT(prgn->rdh.rcBound, X, Y))
2594 {
2595 r = prgn->Buffer;
2596 for (i = 0; i < prgn->rdh.nCount; i++)
2597 {
2598 if (INRECT(r[i], X, Y))
2599 return TRUE;
2600 }
2601 }
#define Y(I)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define INRECT(r, x, y)
Definition: region.c:14

Referenced by NtGdiExtFloodFill(), NtGdiPtInRegion(), and NtGdiPtVisible().

◆ REGION_RectInRegion()

BOOL FASTCALL REGION_RectInRegion ( PREGION  Rgn,
const RECTL rc 
)

Definition at line 2605 of file region.c.

2611{
2612 PRECTL pCurRect, pRectEnd;
2613 RECT rc;
2614
2615 /* Swap the coordinates to make right >= left and bottom >= top */
2616 /* (region building rectangles are normalized the same way) */
2617 if (rect->top > rect->bottom)
2618 {
2619 rc.top = rect->bottom;
2620 rc.bottom = rect->top;
2621 }
2622 else
2623 {
2624 rc.top = rect->top;
2625 rc.bottom = rect->bottom;
2626 }
2627
2628 if (rect->right < rect->left)
2629 {
2630 rc.right = rect->left;
2631 rc.left = rect->right;
2632 }
2633 else
2634 {
2635 rc.right = rect->right;
2636 rc.left = rect->left;
2637 }
2638
2639 /* This is (just) a useful optimization */
2640 if ((Rgn->rdh.nCount > 0) && EXTENTCHECK(&Rgn->rdh.rcBound, &rc))
2641 {
2642 for (pCurRect = Rgn->Buffer, pRectEnd = pCurRect +
2643 Rgn->rdh.nCount; pCurRect < pRectEnd; pCurRect++)
2644 {
2645 if (pCurRect->bottom <= rc.top)
2646 continue; /* Not far enough down yet */
2647
2648 if (pCurRect->top >= rc.bottom)
2649 break; /* Too far down */
2650
2651 if (pCurRect->right <= rc.left)
2652 continue; /* Not far enough over yet */
2653
2654 if (pCurRect->left >= rc.right)
2655 {
2656 continue;
2657 }
2658
2659 return TRUE;
2660 }
2661 }

Referenced by IntRectInRegion(), and NtGdiRectVisible().

◆ REGION_SetPolyPolygonRgn()

BOOL FASTCALL REGION_SetPolyPolygonRgn ( _Inout_ PREGION  prgn,
_In_ const POINT ppt,
_In_ const ULONG pcPoints,
_In_ ULONG  cPolygons,
_In_ INT  iMode 
)

Definition at line 3254 of file region.c.

3263{
3264 EDGE_TABLE_ENTRY *pAET; /* Active Edge Table */
3265 INT y; /* Current scanline */
3266 INT iPts = 0; /* Number of pts in buffer */
3267 EDGE_TABLE_ENTRY *pWETE; /* Winding Edge Table Entry */
3268 SCANLINE_LIST *pSLL; /* Current SCANLINE_LIST */
3269 POINT *pts; /* Output buffer */
3270 EDGE_TABLE_ENTRY *pPrevAET; /* Pointer to previous AET */
3271 EDGE_TABLE ET; /* Header node for ET */
3272 EDGE_TABLE_ENTRY AET; /* Header node for AET */
3273 EDGE_TABLE_ENTRY *pETEs; /* EDGE_TABLEEntries pool */
3274 SCANLINE_LISTBLOCK SLLBlock; /* Header for SCANLINE_LIST */
3275 INT fixWAET = FALSE;
3276 POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers */
3277 POINTBLOCK *tmpPtBlock;
3278 UINT numFullPtBlocks = 0;
3279 UINT poly, total;
3280 BOOL bResult = FALSE;
3281
3282 /* Check if iMode is valid */
3283 if ((iMode != ALTERNATE) && (iMode != WINDING))
3284 {
3285 DPRINT1("Invalid iMode: %lu\n", iMode);
3286 return FALSE;
3287 }
3288
3289 /* Special case a rectangle */
3290 if (((cPolygons == 1) && ((pcPoints[0] == 4) ||
3291 ((pcPoints[0] == 5) && (ppt[4].x == ppt[0].x) && (ppt[4].y == ppt[0].y)))) &&
3292 (((ppt[0].y == ppt[1].y) &&
3293 (ppt[1].x == ppt[2].x) &&
3294 (ppt[2].y == ppt[3].y) &&
3295 (ppt[3].x == ppt[0].x)) ||
3296 ((ppt[0].x == ppt[1].x) &&
3297 (ppt[1].y == ppt[2].y) &&
3298 (ppt[2].x == ppt[3].x) &&
3299 (ppt[3].y == ppt[0].y))))
3300 {
3301 REGION_SetRectRgn(prgn,
3302 min(ppt[0].x, ppt[2].x),
3303 min(ppt[0].y, ppt[2].y),
3304 max(ppt[0].x, ppt[2].x),
3305 max(ppt[0].y, ppt[2].y));
3306 return TRUE;
3307 }
3308
3309 for (poly = total = 0; poly < cPolygons; poly++)
3310 total += pcPoints[poly];
3311
3313 sizeof(EDGE_TABLE_ENTRY) * total,
3314 TAG_REGION);
3315 if (pETEs == NULL)
3316 {
3317 DPRINT1("Failed to allocate %lu edge entries\n", total);
3318 return FALSE;
3319 }
3320
3321 pts = FirstPtBlock.pts;
3322 REGION_CreateETandAET(pcPoints, cPolygons, ppt, &ET, &AET, pETEs, &SLLBlock);
3323 pSLL = ET.scanlines.next;
3324 curPtBlock = &FirstPtBlock;
3325
3326 if (iMode != WINDING)
3327 {
3328 /* For each scanline */
3329 for (y = ET.ymin; y < ET.ymax; y++)
3330 {
3331 /* Add a new edge to the active edge table when we
3332 * get to the next edge. */
3333 if (pSLL != NULL && y == pSLL->scanline)
3334 {
3335 REGION_loadAET(&AET, pSLL->edgelist);
3336 pSLL = pSLL->next;
3337 }
3338 pPrevAET = &AET;
3339 pAET = AET.next;
3340
3341 /* For each active edge */
3342 while (pAET)
3343 {
3344 pts->x = pAET->bres.minor_axis, pts->y = y;
3345 pts++, iPts++;
3346
3347 /* Send out the buffer */
3348 if (iPts == NUMPTSTOBUFFER)
3349 {
3350 tmpPtBlock = ExAllocatePoolWithTag(PagedPool,
3351 sizeof(POINTBLOCK),
3352 TAG_REGION);
3353 if (tmpPtBlock == NULL)
3354 {
3355 DPRINT1("Can't alloc tmpPtBlock\n");
3356 goto Cleanup;
3357 }
3358
3359 curPtBlock->next = tmpPtBlock;
3360 curPtBlock = tmpPtBlock;
3361 pts = curPtBlock->pts;
3362 numFullPtBlocks++;
3363 iPts = 0;
3364 }
3365
3366 EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
3367 }
3368
3370 }
3371 }
3372 else
3373 {
3374 /* For each scanline */
3375 for (y = ET.ymin; y < ET.ymax; y++)
3376 {
3377 /* Add a new edge to the active edge table when we
3378 * get to the next edge. */
3379 if (pSLL != NULL && y == pSLL->scanline)
3380 {
3381 REGION_loadAET(&AET, pSLL->edgelist);
3382 REGION_computeWAET(&AET);
3383 pSLL = pSLL->next;
3384 }
3385
3386 pPrevAET = &AET;
3387 pAET = AET.next;
3388 pWETE = pAET;
3389
3390 /* For each active edge */
3391 while (pAET)
3392 {
3393 /* Add to the buffer only those edges that
3394 * are in the Winding active edge table. */
3395 if (pWETE == pAET)
3396 {
3397 pts->x = pAET->bres.minor_axis;
3398 pts->y = y;
3399 pts++;
3400 iPts++;
3401
3402 /* Send out the buffer */
3403 if (iPts == NUMPTSTOBUFFER)
3404 {
3405 tmpPtBlock = ExAllocatePoolWithTag(PagedPool,
3406 sizeof(POINTBLOCK),
3407 TAG_REGION);
3408 if (tmpPtBlock == NULL)
3409 {
3410 DPRINT1("Can't alloc tPB\n");
3411 goto Cleanup;
3412 }
3413 curPtBlock->next = tmpPtBlock;
3414 curPtBlock = tmpPtBlock;
3415 pts = curPtBlock->pts;
3416 numFullPtBlocks++;
3417 iPts = 0;
3418 }
3419
3420 pWETE = pWETE->nextWETE;
3421 }
3422
3423 EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
3424 }
3425
3426 /* Recompute the winding active edge table if
3427 * we just resorted or have exited an edge. */
3428 if (REGION_InsertionSort(&AET) || fixWAET)
3429 {
3430 REGION_computeWAET(&AET);
3431 fixWAET = FALSE;
3432 }
3433 }
3434 }
3435
3436 REGION_PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, prgn);
3437 bResult = TRUE;
3438
3439Cleanup:
3440 REGION_FreeStorage(SLLBlock.next);
3441
3442 for (curPtBlock = FirstPtBlock.next; numFullPtBlocks-- > 0;)
3443 {
3444 tmpPtBlock = curPtBlock->next;
3445 ExFreePoolWithTag(curPtBlock, TAG_REGION);
3446 curPtBlock = tmpPtBlock;
3447 }
3448
#define ALTERNATE
Definition: constants.h:278
static const WCHAR Cleanup[]
Definition: register.c:80
size_t total
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
@ ET
Definition: bidi.c:79
INT minor_axis
Definition: region.c:245
Definition: region.c:311
BRESINFO bres
Definition: region.c:313
struct _EDGE_TABLE_ENTRY * nextWETE
Definition: region.c:316
struct _EDGE_TABLE_ENTRY * next
Definition: region.c:314
struct _POINTBLOCK * next
Definition: region.c:520
POINT pts[NUMPTSTOBUFFER]
Definition: region.c:519
struct _SCANLINE_LISTBLOCK * next
Definition: region.c:344
struct _SCANLINE_LIST * next
Definition: region.c:324
EDGE_TABLE_ENTRY * edgelist
Definition: region.c:323
INT scanline
Definition: region.c:322
static VOID FASTCALL REGION_CreateETandAET(const ULONG *Count, INT nbpolygons, const POINT *pts, EDGE_TABLE *ET, EDGE_TABLE_ENTRY *AET, EDGE_TABLE_ENTRY *pETEs, SCANLINE_LISTBLOCK *pSLLBlock)
Definition: region.c:3168
static INT FASTCALL REGION_PtsToRegion(INT numFullPtBlocks, INT iCurPtBlock, POINTBLOCK *FirstPtBlock, PREGION reg)
Definition: region.c:3042
static VOID FASTCALL REGION_FreeStorage(SCANLINE_LISTBLOCK *pSLLBlock)
Definition: region.c:3021
#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
Definition: region.c:381
#define NUMPTSTOBUFFER
Definition: region.c:512
static VOID FASTCALL REGION_loadAET(EDGE_TABLE_ENTRY *AET, EDGE_TABLE_ENTRY *ETEs)
Definition: region.c:2884
static VOID FASTCALL REGION_computeWAET(EDGE_TABLE_ENTRY *AET)
Definition: region.c:2937
static BOOL FASTCALL REGION_InsertionSort(EDGE_TABLE_ENTRY *AET)
Definition: region.c:2978
#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET)
Definition: region.c:359

Referenced by GreCreatePolyPolygonRgn(), PATH_PathToRegion(), and REGION_bXformRgn().

◆ REGION_SetRectRgn()

VOID FASTCALL REGION_SetRectRgn ( PREGION  pRgn,
INT  LeftRect,
INT  TopRect,
INT  RightRect,
INT  BottomRect 
)

Definition at line 2665 of file region.c.

2674{
2675 PRECTL firstRect;
2676
2677 if (LeftRect > RightRect)
2678 {
2679 INT tmp = LeftRect;
2680 LeftRect = RightRect;
2681 RightRect = tmp;
2682 }
2683
2684 if (TopRect > BottomRect)
2685 {
2686 INT tmp = TopRect;
2687 TopRect = BottomRect;
2688 BottomRect = tmp;
2689 }
2690
2691 if ((LeftRect != RightRect) && (TopRect != BottomRect))
2692 {
2693 firstRect = rgn->Buffer;
2694 ASSERT(firstRect);
2695 firstRect->left = rgn->rdh.rcBound.left = LeftRect;
2696 firstRect->top = rgn->rdh.rcBound.top = TopRect;
2697 firstRect->right = rgn->rdh.rcBound.right = RightRect;
2698 firstRect->bottom = rgn->rdh.rcBound.bottom = BottomRect;
2699 rgn->rdh.nCount = 1;
2700 rgn->rdh.iType = RDH_RECTANGLES;
2701 }
2702 else
2703 {

Referenced by co_IntGetUpdateRgn(), IntSetDefaultRegion(), IntSysCreateRectpRgn(), NtGdiCreateRectRgn(), NtGdiSelectBitmap(), NtGdiSetRectRgn(), REGION_SetPolyPolygonRgn(), REGION_vSyncRegion(), and UserScrollDC().

◆ REGION_SubtractRectFromRgn()

INT FASTCALL REGION_SubtractRectFromRgn ( PREGION  prgnDest,
PREGION  prgnSrc,
const RECTL prcl 
)

Definition at line 1811 of file region.c.

1818{
1819 REGION rgnLocal;
1820
1821 rgnLocal.Buffer = &rgnLocal.rdh.rcBound;
1822 rgnLocal.rdh.nCount = 1;
1823 rgnLocal.rdh.nRgnSize = sizeof(RECT);
1824 rgnLocal.rdh.rcBound = *prcl;

◆ REGION_UnionRectWithRgn()

BOOL FASTCALL REGION_UnionRectWithRgn ( PREGION  rgn,
const RECTL rect 
)

Adds a rectangle to a REGION

Definition at line 1796 of file region.c.

1802{
1803 REGION region;
1804
1805 region.Buffer = &region.rdh.rcBound;
1806 region.rdh.nCount = 1;
1807 region.rdh.nRgnSize = sizeof(RECT);

Referenced by NtGdiExtCreateRegion().

◆ REGION_UnlockRgn()

VOID FASTCALL REGION_UnlockRgn ( _In_ PREGION  prgn)

Definition at line 2373 of file region.c.

2378{
2379 PRGN_ATTR prgnattr;
2380
2381 NT_ASSERT(prgn != NULL);
2382 NT_ASSERT(prgn->prgnattr != NULL);
2383
2384 /* Get the region attribute and check if it's user mode */
2385 prgnattr = prgn->prgnattr;
2386 if (prgnattr != &prgn->rgnattr)
2387 {
2388 NT_ASSERT(GreGetObjectOwner(prgn->BaseObject.hHmgr) == GDI_OBJ_HMGR_POWNED);
2389 prgnattr->iComplexity = REGION_Complexity(prgn);
2390 prgnattr->Rect.left = prgn->rdh.rcBound.left;
2391 prgnattr->Rect.top = prgn->rdh.rcBound.top;
2392 prgnattr->Rect.right = prgn->rdh.rcBound.right;
2393 prgnattr->Rect.bottom = prgn->rdh.rcBound.bottom;
2394 prgnattr->AttrFlags |= ATTR_RGN_VALID;
2395 }
ULONG NTAPI GreGetObjectOwner(HGDIOBJ hobj)
Definition: gdiobj.c:1192

Referenced by co_IntGetUpdateRgn(), co_WinPosSetWindowPos(), DceUpdateVisRgn(), ForceNCPaintErase(), GreCreateFrameRgn(), GreCreatePolyPolygonRgn(), IntDefWindowProc(), IntGdiGetRgnBox(), IntGdiSetRegionOwner(), IntInvalidateWindows(), IntRectInRegion(), IntScrollWindowEx(), IntValidateParents(), NtGdiCombineRgn(), NtGdiCreateRectRgn(), NtGdiCreateRoundRectRgn(), NtGdiEqualRgn(), NtGdiExtCreateRegion(), NtGdiExtSelectClipRgn(), NtGdiFillRgn(), NtGdiGetRandomRgn(), NtGdiGetRgnBox(), NtGdiInvertRgn(), NtGdiOffsetRgn(), NtGdiPathToRegion(), NtGdiPtInRegion(), NtGdiSetRectRgn(), NtUserCallHwndParamLock(), NtUserRedrawWindow(), PaintSuspendedWindow(), REGION_XorRegion(), UserScrollDC(), and VIS_ComputeVisibleRegion().

◆ REGION_vCleanup()

VOID NTAPI REGION_vCleanup ( PVOID  ObjectBody)

Definition at line 2433 of file region.c.

2437{
2438 PREGION pRgn = (PREGION)ObjectBody;
2440 ASSERT(ppi);
2441
2442 ASSERT(pRgn->prgnattr);
2443 if (pRgn->prgnattr != &pRgn->rgnattr)
2444 GdiPoolFree(ppi->pPoolRgnAttr, pRgn->prgnattr);
2445

Variable Documentation

◆ hrgnDefault

HRGN hrgnDefault
extern

Definition at line 130 of file region.c.

◆ prgnDefault

PREGION prgnDefault
extern

Definition at line 129 of file region.c.

Referenced by DC_InitHack(), IntGdiReleaseVisRgn(), IntSetDefaultRegion(), and REGION_Delete().