ReactOS 0.4.15-dev-6675-gcbc63d8
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 2038 of file region.c.

2045{
2046 PREGION prgnFrame, prgnSrc;
2047 HRGN hrgnFrame;
2048
2049 /* Allocate a new region */
2050 prgnFrame = REGION_AllocUserRgnWithHandle(1);
2051 if (prgnFrame == NULL)
2052 {
2054 return NULL;
2055 }
2056
2057 /* Lock the source region */
2058 prgnSrc = REGION_LockRgn(hrgn);
2059 if (prgnSrc == NULL)
2060 {
2061 REGION_Delete(prgnFrame);
2062 return FALSE;
2063 }
2064
2065 if (REGION_bMakeFrameRegion(prgnFrame, prgnSrc, cx, cy))
2066 {
2067 hrgnFrame = prgnFrame->BaseObject.hHmgr;
2068 REGION_UnlockRgn(prgnFrame);
2069 }
2070 else
2071 {
2072 REGION_Delete(prgnFrame);
2073 hrgnFrame = NULL;
2074 }
2075
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:2465
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2374
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2389
PREGION FASTCALL REGION_AllocUserRgnWithHandle(INT nRgn)
Definition: region.c:2310
static BOOL REGION_bMakeFrameRegion(_Inout_ PREGION prgnDest, _Inout_ PREGION prgnSrc, _In_ INT cx, _In_ INT cy)
Definition: region.c:1953
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by NtGdiFrameRgn().

◆ GreCreatePolyPolygonRgn()

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

Definition at line 3470 of file region.c.

3478{
3479 PREGION prgn;
3480 HRGN hrgn;
3481
3482 /* Allocate a new region */
3484 if (prgn == NULL)
3485 {
3487 return NULL;
3488 }
3489
3490 /* Call the internal function and check for success */
3491 if (REGION_SetPolyPolygonRgn(prgn, ppt, pcPoints, cPolygons, iMode))
3492 {
3493 /* Success, get the handle and unlock the region */
3494 hrgn = prgn->BaseObject.hHmgr;
3495 REGION_UnlockRgn(prgn);
3496 }
3497 else
3498 {
3499 /* Failure, delete the region */
3500 REGION_Delete(prgn);
3501 hrgn = NULL;
3502 }
BOOL FASTCALL REGION_SetPolyPolygonRgn(_Inout_ PREGION prgn, _In_ const POINT *ppt, _In_ const ULONG *pcPoints, _In_ ULONG cPolygons, _In_ INT iMode)
Definition: region.c:3272
_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 2503 of file region.c.

2511{
2512 BOOL Ret = TRUE;
2513
2514 if (prgnDest == NULL)
2515 {
2516 DPRINT("IntGdiCombineRgn: hDest unavailable\n");
2517 return ERROR;
2518 }
2519
2520 if (prgnSrc1 == NULL)
2521 {
2522 DPRINT("IntGdiCombineRgn: hSrc1 unavailable\n");
2523 return ERROR;
2524 }
2525
2526 if (iCombineMode == RGN_COPY)
2527 {
2528 if (!REGION_CopyRegion(prgnDest, prgnSrc1))
2529 return ERROR;
2530
2531 return REGION_Complexity(prgnDest);
2532 }
2533
2534 if (prgnSrc2 == NULL)
2535 {
2536 DPRINT1("IntGdiCombineRgn requires hSrc2 != NULL for combine mode %d!\n", iCombineMode);
2537 ASSERT(FALSE);
2538 return ERROR;
2539 }
2540
2541 switch (iCombineMode)
2542 {
2543 case RGN_AND:
2544 Ret = REGION_IntersectRegion(prgnDest, prgnSrc1, prgnSrc2);
2545 break;
2546 case RGN_OR:
2547 Ret = REGION_UnionRegion(prgnDest, prgnSrc1, prgnSrc2);
2548 break;
2549 case RGN_XOR:
2550 Ret = REGION_XorRegion(prgnDest, prgnSrc1, prgnSrc2);
2551 break;
2552 case RGN_DIFF:
2553 Ret = REGION_SubtractRegion(prgnDest, prgnSrc1, prgnSrc2);
2554 break;
2555 }
#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:564
static BOOL FASTCALL REGION_UnionRegion(PREGION newReg, PREGION reg1, PREGION reg2)
Definition: region.c:1475
static BOOL FASTCALL REGION_XorRegion(PREGION dr, PREGION sra, PREGION srb)
Definition: region.c:1765
static BOOL FASTCALL REGION_IntersectRegion(PREGION newReg, PREGION reg1, PREGION reg2)
Definition: region.c:1303
static BOOL FASTCALL REGION_SubtractRegion(PREGION regD, PREGION regM, PREGION regS)
Definition: region.c:1729
static BOOL FASTCALL REGION_CopyRegion(PREGION dst, PREGION src)
Definition: region.c:584
#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 2475 of file region.c.

2479{
2480 PREGION prgn;
2481 PRGN_ATTR prgnattr;
2482 PPROCESSINFO ppi;
2483
2484 prgn = REGION_LockRgn(hRgn);
2485 if (prgn == NULL)
2486 {
2487 return FALSE;
2488 }
2489
2490 prgnattr = prgn->prgnattr;
2491 if (prgnattr != &prgn->rgnattr)
2492 {
2494 prgn->prgnattr = &prgn->rgnattr;
2496 GdiPoolFree(ppi->pPoolRgnAttr, prgnattr);
2497 }
2498
2499 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 3506 of file region.c.

3512{
3513 PREGION Rgn;
3514 BOOL Ret;
3515
3516 Rgn = REGION_LockRgn(hRgn);
3517 if (Rgn == NULL)
3518 {
3519 return ERROR;
3520 }
3521
3522 Ret = REGION_RectInRegion(Rgn, rc);
BOOL FASTCALL REGION_RectInRegion(PREGION Rgn, const RECTL *rect)
Definition: region.c:2622

Referenced by NtGdiRectInRegion().

◆ IntSysCreateRectpRgn()

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

Definition at line 2423 of file region.c.

2431{
2432 PREGION prgn;
2433
2434 /* Allocate a region, without a handle */
2436 if (prgn == NULL)
2437 {
2438 return NULL;
2439 }
2440
2441 /* Initialize it */
2442 prgn->Buffer = &prgn->rdh.rcBound;
2443 prgn->prgnattr = &prgn->rgnattr;
2445 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:2682

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 2216 of file region.c.

2221{
2222 //HRGN hReg;
2223 PREGION pReg;
2224
2226 sizeof(REGION),
2228 if (pReg == NULL)
2229 {
2230 DPRINT1("Could not allocate a palette.\n");
2231 return NULL;
2232 }
2233
2234 //hReg = pReg->BaseObject.hHmgr;
2235
2236 if ((nReg == 0) || (nReg == 1))
2237 {
2238 /* Testing shows that > 95% of all regions have only 1 rect.
2239 Including that here saves us from having to do another allocation */
2240 pReg->Buffer = &pReg->rdh.rcBound;
2241 }
2242 else
2243 {
2245 nReg * sizeof(RECT),
2246 TAG_REGION);
2247 if (pReg->Buffer == NULL)
2248 {
2249 DPRINT1("Could not allocate region buffer\n");
2251 return NULL;
2252 }
2253 }
2254
2255 EMPTY_REGION(pReg);
2256 pReg->rdh.dwSize = sizeof(RGNDATAHEADER);
2257 pReg->rdh.nCount = nReg;
2258 pReg->rdh.nRgnSize = nReg * sizeof(RECT);
2259 pReg->prgnattr = &pReg->rgnattr;
2260
2261 /* Initialize the region attribute */
2262 pReg->rgnattr.AttrFlags = 0;
2264 pReg->rgnattr.Rect = pReg->rdh.rcBound;
2265
2266 /* Finally insert the region into the handle table */
2268 {
2269 DPRINT1("Could not insert palette into handle table.\n");
2271 return NULL;
2272 }
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:149
#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 2310 of file region.c.

2315{
2316 PREGION prgn;
2317
2318 prgn = REGION_AllocRgnWithHandle(nRgn);
2319 if (prgn == NULL)
2320 {
2321 return NULL;
2322 }
2323
2324 if (!REGION_bAllocRgnAttr(prgn))
2325 {
2326 ASSERT(FALSE);
2327 }
BOOL NTAPI REGION_bAllocRgnAttr(PREGION prgn)
Definition: region.c:2276
PREGION FASTCALL REGION_AllocRgnWithHandle(INT nReg)
Definition: region.c:2216

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 2724 of file region.c.

2731{
2732 PRECTL prcl;
2733 UINT i;
2734
2735 NT_ASSERT(prgn != NULL);
2736
2737 /* Check for trivial case */
2738 if ((cx == 0) && (cy == 0))
2739 {
2740 return TRUE;
2741 }
2742
2743 /* Check for empty regions, we ignore the offset values here */
2744 if (prgn->rdh.nCount == 0)
2745 {
2746 return TRUE;
2747 }
2748
2749 /* Make sure the offset is within the legal range */
2750 if ((cx > MAX_COORD) || (cx < MIN_COORD) ||
2751 (cy > MAX_COORD) || (cy < MIN_COORD))
2752 {
2753 return FALSE;
2754 }
2755
2756 /* Are we moving right? */
2757 if (cx > 0)
2758 {
2759 /* Check if we stay inside the bounds on the right side */
2760 if (prgn->rdh.rcBound.right > (MAX_COORD - cx))
2761 {
2762 return FALSE;
2763 }
2764 }
2765 else
2766 {
2767 /* Check if we stay inside the bounds on the left side */
2768 if (prgn->rdh.rcBound.left < (MIN_COORD - cx))
2769 {
2770 return FALSE;
2771 }
2772 }
2773
2774 /* Are we moving down? */
2775 if (cy > 0)
2776 {
2777 /* Check if we stay inside the bounds on the right side */
2778 if (prgn->rdh.rcBound.bottom > (MAX_COORD - cy))
2779 {
2780 return FALSE;
2781 }
2782 }
2783 else
2784 {
2785 /* Check if we stay inside the bounds on the left side */
2786 if (prgn->rdh.rcBound.top < (MIN_COORD - cy))
2787 {
2788 return FALSE;
2789 }
2790 }
2791
2792 /* Loop to move the rects */
2793 prcl = prgn->Buffer;
2794 for (i = 0; i < prgn->rdh.nCount; i++)
2795 {
2796 prcl[i].left += cx;
2797 prcl[i].right += cx;
2798 prcl[i].top += cy;
2799 prcl[i].bottom += cy;
2800 }
2801
2802 /* Finally update the bounds rect */
2803 if (prgn->Buffer != &prgn->rdh.rcBound)
2804 {
2805 prgn->rdh.rcBound.left += cx;
2806 prgn->rdh.rcBound.right += cx;
2807 prgn->rdh.rcBound.top += cy;
2808 prgn->rdh.rcBound.bottom += cy;
2809 }
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 2079 of file region.c.

2085{
2086 XFORMOBJ xo;
2087 ULONG i, cjSize;
2088 PPOINT ppt;
2089 PULONG pcPoints;
2090 RECT rect;
2091 BOOL bResult;
2092
2093 /* Check for zero rectangles and return TRUE for translation only matrices */
2094 if (prgn->rdh.nCount < 1)
2095 return (pmx->flAccel & XFORM_UNITY) != 0;
2096
2097 /* Check if this is a scaling only matrix (off-diagonal elements are 0 */
2098 if (pmx->flAccel & XFORM_SCALE)
2099 {
2100 /* Check if this is a translation only matrix */
2101 if (pmx->flAccel & XFORM_UNITY)
2102 {
2103 /* Just offset the region */
2104 return REGION_bOffsetRgn(prgn, (pmx->fxDx + 8) / 16, (pmx->fxDy + 8) / 16);
2105 }
2106 else
2107 {
2108 /* Initialize the xform object */
2109 XFORMOBJ_vInit(&xo, pmx);
2110
2111 /* Scaling can move the rects out of the coordinate space, so
2112 * we first need to check whether we can apply the transformation
2113 * on the bounds rect without modifying the region */
2114 if (!XFORMOBJ_bApplyXform(&xo, XF_LTOL, 2, &prgn->rdh.rcBound, &rect))
2115 {
2116 return FALSE;
2117 }
2118
2119 /* Apply the xform to the rects in the region */
2120 if (!XFORMOBJ_bApplyXform(&xo,
2121 XF_LTOL,
2122 prgn->rdh.nCount * 2,
2123 prgn->Buffer,
2124 prgn->Buffer))
2125 {
2126 /* This can not happen, since we already checked the bounds! */
2128 }
2129
2130 /* Reset bounds */
2131 RECTL_vSetEmptyRect(&prgn->rdh.rcBound);
2132
2133 /* Loop all rects in the region */
2134 for (i = 0; i < prgn->rdh.nCount; i++)
2135 {
2136 /* Make sure the rect is well-ordered after the xform */
2137 RECTL_vMakeWellOrdered(&prgn->Buffer[i]);
2138
2139 /* Update bounds */
2140 if (!RECTL_bUnionRect(&prgn->rdh.rcBound,
2141 &prgn->rdh.rcBound,
2142 &prgn->Buffer[i]))
2143 {
2144 DPRINT1("NULL Set in Union Rects\n");
2145 return FALSE;
2146 }
2147 }
2148
2149 /* Loop all rects in the region */
2150 for (i = 0; i < prgn->rdh.nCount - 1; i++)
2151 {
2152 NT_ASSERT(prgn->Buffer[i].top <= prgn->Buffer[i].bottom);
2153 NT_ASSERT(prgn->Buffer[i + 1].top >= prgn->Buffer[i].top);
2154 }
2155
2156 return TRUE;
2157 }
2158 }
2159 else
2160 {
2161 /* Allocate a buffer for the polygons */
2162 cjSize = prgn->rdh.nCount * (4 * sizeof(POINT) + sizeof(ULONG));
2164 if (ppt == NULL)
2165 {
2166 return FALSE;
2167 }
2168
2169 /* Fill the buffer with the rects */
2170 pcPoints = (PULONG)&ppt[4 * prgn->rdh.nCount];
2171 for (i = 0; i < prgn->rdh.nCount; i++)
2172 {
2173 /* Make sure the rect is within the legal range */
2174 pcPoints[i] = 4;
2175 ppt[4 * i + 0].x = prgn->Buffer[i].left;
2176 ppt[4 * i + 0].y = prgn->Buffer[i].top;
2177 ppt[4 * i + 1].x = prgn->Buffer[i].right;
2178 ppt[4 * i + 1].y = prgn->Buffer[i].top;
2179 ppt[4 * i + 2].x = prgn->Buffer[i].right;
2180 ppt[4 * i + 2].y = prgn->Buffer[i].bottom;
2181 ppt[4 * i + 3].x = prgn->Buffer[i].left;
2182 ppt[4 * i + 3].y = prgn->Buffer[i].bottom;
2183 }
2184
2185 /* Initialize the xform object */
2186 XFORMOBJ_vInit(&xo, pmx);
2187
2188 /* Apply the xform to the rects in the buffer */
2189 if (!XFORMOBJ_bApplyXform(&xo,
2190 XF_LTOL,
2191 prgn->rdh.nCount * 2,
2192 ppt,
2193 ppt))
2194 {
2195 /* This means, there were coordinates that would go outside of
2196 the coordinate space after the transformation */
2198 return FALSE;
2199 }
2200
2201 /* Now use the polygons to create a polygon region */
2202 bResult = REGION_SetPolyPolygonRgn(prgn,
2203 ppt,
2204 pcPoints,
2205 prgn->rdh.nCount,
2206 WINDING);
2207
2208 /* Free the polygon buffer */
2210
2211 return bResult;
#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:2724
#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 564 of file region.c.

568{
569 if (prgn == NULL)
570 return NULLREGION;
571
572 DPRINT("Region Complexity -> %lu", prgn->rdh.nCount);
573 switch (prgn->rdh.nCount)
574 {
575 case 0:
576 return NULLREGION;
577 case 1:
578 return SIMPLEREGION;
579 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 675 of file region.c.

682{
683 PRECTL lpr, rpr;
684 ULONG i, j, clipa, clipb, nRgnSize;
685 INT left = MAXLONG;
686 INT right = MINLONG;
687 INT top = MAXLONG;
689
690 if ((rect->left >= rect->right) ||
691 (rect->top >= rect->bottom) ||
692 (EXTENTCHECK(rect, &rgnSrc->rdh.rcBound) == 0))
693 {
694 goto empty;
695 }
696
697 /* Skip all rects that are completely above our intersect rect */
698 for (clipa = 0; clipa < rgnSrc->rdh.nCount; clipa++)
699 {
700 /* bottom is exclusive, so break when we go above it */
701 if (rgnSrc->Buffer[clipa].bottom > rect->top) break;
702 }
703
704 /* Bail out, if there is nothing left */
705 if (clipa == rgnSrc->rdh.nCount) goto empty;
706
707 /* Find the last rect that is still within the intersect rect (exclusive) */
708 for (clipb = clipa; clipb < rgnSrc->rdh.nCount; clipb++)
709 {
710 /* bottom is exclusive, so stop, when we start at that y pos */
711 if (rgnSrc->Buffer[clipb].top >= rect->bottom) break;
712 }
713
714 /* Bail out, if there is nothing left */
715 if (clipb == clipa) goto empty;
716
717 // clipa - index of the first rect in the first intersecting band
718 // clipb - index of the last rect in the last intersecting band plus 1
719
720 /* Check if the buffer in the dest region is large enough,
721 otherwise allocate a new one */
722 nRgnSize = (clipb - clipa) * sizeof(RECT);
723 if ((rgnDst != rgnSrc) && (rgnDst->rdh.nRgnSize < nRgnSize))
724 {
725 PRECTL temp;
727 if (temp == NULL)
728 return ERROR;
729
730 /* Free the old buffer */
731 if (rgnDst->Buffer && (rgnDst->Buffer != &rgnDst->rdh.rcBound))
733
734 rgnDst->Buffer = temp;
735 rgnDst->rdh.nCount = 0;
736 rgnDst->rdh.nRgnSize = nRgnSize;
737 rgnDst->rdh.iType = RDH_RECTANGLES;
738 }
739
740 /* Loop all rects within the intersect rect from the y perspective */
741 for (i = clipa, j = 0; i < clipb ; i++)
742 {
743 /* i - src index, j - dst index, j is always <= i for obvious reasons */
744
745 lpr = &rgnSrc->Buffer[i];
746
747 /* Make sure the source rect is not retarded */
748 ASSERT(lpr->bottom > lpr->top);
749 ASSERT(lpr->right > lpr->left);
750
751 /* We already checked above, this should hold true */
752 ASSERT(lpr->bottom > rect->top);
753 ASSERT(lpr->top < rect->bottom);
754
755 /* Check if this rect is really inside the intersect rect */
756 if ((lpr->left < rect->right) && (lpr->right > rect->left))
757 {
758 rpr = &rgnDst->Buffer[j];
759
760 /* Crop the rect with the intersect rect */
761 rpr->top = max(lpr->top, rect->top);
762 rpr->bottom = min(lpr->bottom, rect->bottom);
763 rpr->left = max(lpr->left, rect->left);
764 rpr->right = min(lpr->right, rect->right);
765
766 /* Make sure the resulting rect is not retarded */
767 ASSERT(rpr->bottom > rpr->top);
768 ASSERT(rpr->right > rpr->left);
769
770 /* Track new bounds */
771 if (rpr->left < left) left = rpr->left;
772 if (rpr->right > right) right = rpr->right;
773 if (rpr->top < top) top = rpr->top;
774 if (rpr->bottom > bottom) bottom = rpr->bottom;
775
776 /* Next target rect */
777 j++;
778 }
779 }
780
781 if (j == 0) goto empty;
782
783 /* Update the bounds rect */
784 rgnDst->rdh.rcBound.left = left;
785 rgnDst->rdh.rcBound.right = right;
786 rgnDst->rdh.rcBound.top = top;
787 rgnDst->rdh.rcBound.bottom = bottom;
788
789 /* Set new rect count */
790 rgnDst->rdh.nCount = j;
791
792 return REGION_Complexity(rgnDst);
793
794empty:
795 if (rgnDst->Buffer == NULL)
796 {
797 rgnDst->Buffer = &rgnDst->rdh.rcBound;
798 }
799
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:167
#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 2599 of file region.c.

2606{
2607 ULONG i;
2608 PRECT r;
2609
2610 if (prgn->rdh.nCount > 0 && INRECT(prgn->rdh.rcBound, X, Y))
2611 {
2612 r = prgn->Buffer;
2613 for (i = 0; i < prgn->rdh.nCount; i++)
2614 {
2615 if (INRECT(r[i], X, Y))
2616 return TRUE;
2617 }
2618 }
#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 2622 of file region.c.

2628{
2629 PRECTL pCurRect, pRectEnd;
2630 RECT rc;
2631
2632 /* Swap the coordinates to make right >= left and bottom >= top */
2633 /* (region building rectangles are normalized the same way) */
2634 if (rect->top > rect->bottom)
2635 {
2636 rc.top = rect->bottom;
2637 rc.bottom = rect->top;
2638 }
2639 else
2640 {
2641 rc.top = rect->top;
2642 rc.bottom = rect->bottom;
2643 }
2644
2645 if (rect->right < rect->left)
2646 {
2647 rc.right = rect->left;
2648 rc.left = rect->right;
2649 }
2650 else
2651 {
2652 rc.right = rect->right;
2653 rc.left = rect->left;
2654 }
2655
2656 /* This is (just) a useful optimization */
2657 if ((Rgn->rdh.nCount > 0) && EXTENTCHECK(&Rgn->rdh.rcBound, &rc))
2658 {
2659 for (pCurRect = Rgn->Buffer, pRectEnd = pCurRect +
2660 Rgn->rdh.nCount; pCurRect < pRectEnd; pCurRect++)
2661 {
2662 if (pCurRect->bottom <= rc.top)
2663 continue; /* Not far enough down yet */
2664
2665 if (pCurRect->top >= rc.bottom)
2666 break; /* Too far down */
2667
2668 if (pCurRect->right <= rc.left)
2669 continue; /* Not far enough over yet */
2670
2671 if (pCurRect->left >= rc.right)
2672 {
2673 continue;
2674 }
2675
2676 return TRUE;
2677 }
2678 }

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 3272 of file region.c.

3281{
3282 EDGE_TABLE_ENTRY *pAET; /* Active Edge Table */
3283 INT y; /* Current scanline */
3284 INT iPts = 0; /* Number of pts in buffer */
3285 EDGE_TABLE_ENTRY *pWETE; /* Winding Edge Table Entry */
3286 SCANLINE_LIST *pSLL; /* Current SCANLINE_LIST */
3287 POINT *pts; /* Output buffer */
3288 EDGE_TABLE_ENTRY *pPrevAET; /* Pointer to previous AET */
3289 EDGE_TABLE ET; /* Header node for ET */
3290 EDGE_TABLE_ENTRY AET; /* Header node for AET */
3291 EDGE_TABLE_ENTRY *pETEs; /* EDGE_TABLEEntries pool */
3292 SCANLINE_LISTBLOCK SLLBlock; /* Header for SCANLINE_LIST */
3293 INT fixWAET = FALSE;
3294 POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers */
3295 POINTBLOCK *tmpPtBlock;
3296 UINT numFullPtBlocks = 0;
3297 UINT poly, total;
3298 BOOL bResult = FALSE;
3299
3300 /* Check if iMode is valid */
3301 if ((iMode != ALTERNATE) && (iMode != WINDING))
3302 {
3303 DPRINT1("Invalid iMode: %lu\n", iMode);
3304 return FALSE;
3305 }
3306
3307 /* Special case a rectangle */
3308 if (((cPolygons == 1) && ((pcPoints[0] == 4) ||
3309 ((pcPoints[0] == 5) && (ppt[4].x == ppt[0].x) && (ppt[4].y == ppt[0].y)))) &&
3310 (((ppt[0].y == ppt[1].y) &&
3311 (ppt[1].x == ppt[2].x) &&
3312 (ppt[2].y == ppt[3].y) &&
3313 (ppt[3].x == ppt[0].x)) ||
3314 ((ppt[0].x == ppt[1].x) &&
3315 (ppt[1].y == ppt[2].y) &&
3316 (ppt[2].x == ppt[3].x) &&
3317 (ppt[3].y == ppt[0].y))))
3318 {
3319 REGION_SetRectRgn(prgn,
3320 min(ppt[0].x, ppt[2].x),
3321 min(ppt[0].y, ppt[2].y),
3322 max(ppt[0].x, ppt[2].x),
3323 max(ppt[0].y, ppt[2].y));
3324 return TRUE;
3325 }
3326
3327 for (poly = total = 0; poly < cPolygons; poly++)
3328 total += pcPoints[poly];
3329
3331 sizeof(EDGE_TABLE_ENTRY) * total,
3332 TAG_REGION);
3333 if (pETEs == NULL)
3334 {
3335 DPRINT1("Failed to allocate %lu edge entries\n", total);
3336 return FALSE;
3337 }
3338
3339 pts = FirstPtBlock.pts;
3340 REGION_CreateETandAET(pcPoints, cPolygons, ppt, &ET, &AET, pETEs, &SLLBlock);
3341 pSLL = ET.scanlines.next;
3342 curPtBlock = &FirstPtBlock;
3343
3344 if (iMode != WINDING)
3345 {
3346 /* For each scanline */
3347 for (y = ET.ymin; y < ET.ymax; y++)
3348 {
3349 /* Add a new edge to the active edge table when we
3350 * get to the next edge. */
3351 if (pSLL != NULL && y == pSLL->scanline)
3352 {
3353 REGION_loadAET(&AET, pSLL->edgelist);
3354 pSLL = pSLL->next;
3355 }
3356 pPrevAET = &AET;
3357 pAET = AET.next;
3358
3359 /* For each active edge */
3360 while (pAET)
3361 {
3362 pts->x = pAET->bres.minor_axis, pts->y = y;
3363 pts++, iPts++;
3364
3365 /* Send out the buffer */
3366 if (iPts == NUMPTSTOBUFFER)
3367 {
3368 tmpPtBlock = ExAllocatePoolWithTag(PagedPool,
3369 sizeof(POINTBLOCK),
3370 TAG_REGION);
3371 if (tmpPtBlock == NULL)
3372 {
3373 DPRINT1("Can't alloc tmpPtBlock\n");
3374 goto Cleanup;
3375 }
3376
3377 curPtBlock->next = tmpPtBlock;
3378 curPtBlock = tmpPtBlock;
3379 pts = curPtBlock->pts;
3380 numFullPtBlocks++;
3381 iPts = 0;
3382 }
3383
3384 EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
3385 }
3386
3388 }
3389 }
3390 else
3391 {
3392 /* For each scanline */
3393 for (y = ET.ymin; y < ET.ymax; y++)
3394 {
3395 /* Add a new edge to the active edge table when we
3396 * get to the next edge. */
3397 if (pSLL != NULL && y == pSLL->scanline)
3398 {
3399 REGION_loadAET(&AET, pSLL->edgelist);
3400 REGION_computeWAET(&AET);
3401 pSLL = pSLL->next;
3402 }
3403
3404 pPrevAET = &AET;
3405 pAET = AET.next;
3406 pWETE = pAET;
3407
3408 /* For each active edge */
3409 while (pAET)
3410 {
3411 /* Add to the buffer only those edges that
3412 * are in the Winding active edge table. */
3413 if (pWETE == pAET)
3414 {
3415 pts->x = pAET->bres.minor_axis;
3416 pts->y = y;
3417 pts++;
3418 iPts++;
3419
3420 /* Send out the buffer */
3421 if (iPts == NUMPTSTOBUFFER)
3422 {
3423 tmpPtBlock = ExAllocatePoolWithTag(PagedPool,
3424 sizeof(POINTBLOCK),
3425 TAG_REGION);
3426 if (tmpPtBlock == NULL)
3427 {
3428 DPRINT1("Can't alloc tPB\n");
3429 goto Cleanup;
3430 }
3431 curPtBlock->next = tmpPtBlock;
3432 curPtBlock = tmpPtBlock;
3433 pts = curPtBlock->pts;
3434 numFullPtBlocks++;
3435 iPts = 0;
3436 }
3437
3438 pWETE = pWETE->nextWETE;
3439 }
3440
3441 EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
3442 }
3443
3444 /* Recompute the winding active edge table if
3445 * we just resorted or have exited an edge. */
3446 if (REGION_InsertionSort(&AET) || fixWAET)
3447 {
3448 REGION_computeWAET(&AET);
3449 fixWAET = FALSE;
3450 }
3451 }
3452 }
3453
3454 REGION_PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, prgn);
3455 bResult = TRUE;
3456
3457Cleanup:
3458 REGION_FreeStorage(SLLBlock.next);
3459
3460 for (curPtBlock = FirstPtBlock.next; numFullPtBlocks-- > 0;)
3461 {
3462 tmpPtBlock = curPtBlock->next;
3463 ExFreePoolWithTag(curPtBlock, TAG_REGION);
3464 curPtBlock = tmpPtBlock;
3465 }
3466
#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:246
Definition: region.c:315
BRESINFO bres
Definition: region.c:317
struct _EDGE_TABLE_ENTRY * nextWETE
Definition: region.c:320
struct _EDGE_TABLE_ENTRY * next
Definition: region.c:318
struct _POINTBLOCK * next
Definition: region.c:529
POINT pts[NUMPTSTOBUFFER]
Definition: region.c:528
struct _SCANLINE_LISTBLOCK * next
Definition: region.c:351
struct _SCANLINE_LIST * next
Definition: region.c:329
EDGE_TABLE_ENTRY * edgelist
Definition: region.c:328
INT scanline
Definition: region.c:327
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:3186
static INT FASTCALL REGION_PtsToRegion(INT numFullPtBlocks, INT iCurPtBlock, POINTBLOCK *FirstPtBlock, PREGION reg)
Definition: region.c:3060
static VOID FASTCALL REGION_FreeStorage(SCANLINE_LISTBLOCK *pSLLBlock)
Definition: region.c:3038
#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
Definition: region.c:390
#define NUMPTSTOBUFFER
Definition: region.c:521
static VOID FASTCALL REGION_loadAET(EDGE_TABLE_ENTRY *AET, EDGE_TABLE_ENTRY *ETEs)
Definition: region.c:2901
static VOID FASTCALL REGION_computeWAET(EDGE_TABLE_ENTRY *AET)
Definition: region.c:2954
static BOOL FASTCALL REGION_InsertionSort(EDGE_TABLE_ENTRY *AET)
Definition: region.c:2995
#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET)
Definition: region.c:367

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 2682 of file region.c.

2691{
2692 PRECTL firstRect;
2693
2694 if (LeftRect > RightRect)
2695 {
2696 INT tmp = LeftRect;
2697 LeftRect = RightRect;
2698 RightRect = tmp;
2699 }
2700
2701 if (TopRect > BottomRect)
2702 {
2703 INT tmp = TopRect;
2704 TopRect = BottomRect;
2705 BottomRect = tmp;
2706 }
2707
2708 if ((LeftRect != RightRect) && (TopRect != BottomRect))
2709 {
2710 firstRect = rgn->Buffer;
2711 ASSERT(firstRect);
2712 firstRect->left = rgn->rdh.rcBound.left = LeftRect;
2713 firstRect->top = rgn->rdh.rcBound.top = TopRect;
2714 firstRect->right = rgn->rdh.rcBound.right = RightRect;
2715 firstRect->bottom = rgn->rdh.rcBound.bottom = BottomRect;
2716 rgn->rdh.nCount = 1;
2717 rgn->rdh.iType = RDH_RECTANGLES;
2718 }
2719 else
2720 {

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 1824 of file region.c.

1831{
1832 REGION rgnLocal;
1833
1834 rgnLocal.Buffer = &rgnLocal.rdh.rcBound;
1835 rgnLocal.rdh.nCount = 1;
1836 rgnLocal.rdh.nRgnSize = sizeof(RECT);
1837 rgnLocal.rdh.rcBound = *prcl;

◆ REGION_UnionRectWithRgn()

BOOL FASTCALL REGION_UnionRectWithRgn ( PREGION  rgn,
const RECTL rect 
)

Adds a rectangle to a REGION

Definition at line 1809 of file region.c.

1815{
1816 REGION region;
1817
1818 region.Buffer = &region.rdh.rcBound;
1819 region.rdh.nCount = 1;
1820 region.rdh.nRgnSize = sizeof(RECT);

Referenced by NtGdiExtCreateRegion().

◆ REGION_UnlockRgn()

VOID FASTCALL REGION_UnlockRgn ( _In_ PREGION  prgn)

Definition at line 2389 of file region.c.

2394{
2395 PRGN_ATTR prgnattr;
2396
2397 NT_ASSERT(prgn != NULL);
2398 NT_ASSERT(prgn->prgnattr != NULL);
2399
2400 /* Get the region attribute and check if it's user mode */
2401 prgnattr = prgn->prgnattr;
2402 if (prgnattr != &prgn->rgnattr)
2403 {
2404 NT_ASSERT(GreGetObjectOwner(prgn->BaseObject.hHmgr) == GDI_OBJ_HMGR_POWNED);
2405 prgnattr->iComplexity = REGION_Complexity(prgn);
2406 prgnattr->Rect.left = prgn->rdh.rcBound.left;
2407 prgnattr->Rect.top = prgn->rdh.rcBound.top;
2408 prgnattr->Rect.right = prgn->rdh.rcBound.right;
2409 prgnattr->Rect.bottom = prgn->rdh.rcBound.bottom;
2410 prgnattr->AttrFlags |= ATTR_RGN_VALID;
2411 }
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 2449 of file region.c.

2453{
2454 PREGION pRgn = (PREGION)ObjectBody;
2456 ASSERT(ppi);
2457
2458 ASSERT(pRgn->prgnattr);
2459 if (pRgn->prgnattr != &pRgn->rgnattr)
2460 GdiPoolFree(ppi->pPoolRgnAttr, pRgn->prgnattr);
2461

Variable Documentation

◆ hrgnDefault

HRGN hrgnDefault
extern

Definition at line 131 of file region.c.

◆ prgnDefault

PREGION prgnDefault
extern

Definition at line 130 of file region.c.

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