ReactOS  0.4.13-dev-52-g0efcfec
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 2041 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 
2076  REGION_UnlockRgn(prgnSrc);
2077  return hrgnFrame;
2078 }
BASEOBJECT BaseObject
Definition: region.h:11
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2380
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
smooth NULL
Definition: ftsmooth.c:416
Definition: region.h:7
static BOOL REGION_bMakeFrameRegion(_Inout_ PREGION prgnDest, _Inout_ PREGION prgnSrc, _In_ INT cx, _In_ INT cy)
Definition: region.c:1956
static HRGN hrgn
Definition: win.c:55
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2395
_Out_opt_ int * cx
Definition: commctrl.h:570
PREGION FASTCALL REGION_AllocUserRgnWithHandle(INT nRgn)
Definition: region.c:2316
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2471
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by NtGdiFrameRgn().

◆ GreCreatePolyPolygonRgn()

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

Definition at line 3474 of file region.c.

3479 {
3480  PREGION prgn;
3481  HRGN hrgn;
3482 
3483  /* Allocate a new region */
3485  if (prgn == NULL)
3486  {
3488  return NULL;
3489  }
3490 
3491  /* Call the internal function and check for success */
3492  if (REGION_SetPolyPolygonRgn(prgn, ppt, pcPoints, cPolygons, iMode))
3493  {
3494  /* Success, get the handle and unlock the region */
3495  hrgn = prgn->BaseObject.hHmgr;
3496  REGION_UnlockRgn(prgn);
3497  }
3498  else
3499  {
3500  /* Failure, delete the region */
3501  REGION_Delete(prgn);
3502  hrgn = NULL;
3503  }
3504 
3505  return hrgn;
3506 }
BASEOBJECT BaseObject
Definition: region.h:11
BOOL FASTCALL REGION_SetPolyPolygonRgn(_Inout_ PREGION prgn, _In_ const POINT *ppt, _In_ const ULONG *pcPoints, _In_ ULONG cPolygons, _In_ INT iMode)
Definition: region.c:3278
_In_ ULONG iMode
Definition: winddi.h:3520
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
smooth NULL
Definition: ftsmooth.c:416
Definition: region.h:7
static HRGN hrgn
Definition: win.c:55
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2395
PREGION FASTCALL REGION_AllocUserRgnWithHandle(INT nRgn)
Definition: region.c:2316
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2471
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by NtGdiPolyPolyDraw().

◆ IntGdiCombineRgn()

INT FASTCALL IntGdiCombineRgn ( PREGION  ,
PREGION  ,
PREGION  ,
INT   
)

Definition at line 2509 of file region.c.

2514 {
2515  BOOL Ret = TRUE;
2516 
2517  if (prgnDest == NULL)
2518  {
2519  DPRINT("IntGdiCombineRgn: hDest unavailable\n");
2520  return ERROR;
2521  }
2522 
2523  if (prgnSrc1 == NULL)
2524  {
2525  DPRINT("IntGdiCombineRgn: hSrc1 unavailable\n");
2526  return ERROR;
2527  }
2528 
2529  if (iCombineMode == RGN_COPY)
2530  {
2531  if (!REGION_CopyRegion(prgnDest, prgnSrc1))
2532  return ERROR;
2533 
2534  return REGION_Complexity(prgnDest);
2535  }
2536 
2537  if (prgnSrc2 == NULL)
2538  {
2539  DPRINT1("IntGdiCombineRgn requires hSrc2 != NULL for combine mode %d!\n", iCombineMode);
2540  ASSERT(FALSE);
2541  return ERROR;
2542  }
2543 
2544  switch (iCombineMode)
2545  {
2546  case RGN_AND:
2547  Ret = REGION_IntersectRegion(prgnDest, prgnSrc1, prgnSrc2);
2548  break;
2549  case RGN_OR:
2550  Ret = REGION_UnionRegion(prgnDest, prgnSrc1, prgnSrc2);
2551  break;
2552  case RGN_XOR:
2553  Ret = REGION_XorRegion(prgnDest, prgnSrc1, prgnSrc2);
2554  break;
2555  case RGN_DIFF:
2556  Ret = REGION_SubtractRegion(prgnDest, prgnSrc1, prgnSrc2);
2557  break;
2558  }
2559 
2560  return Ret ? REGION_Complexity(prgnDest) : ERROR;
2561 }
static BOOL FASTCALL REGION_CopyRegion(PREGION dst, PREGION src)
Definition: region.c:587
#define TRUE
Definition: types.h:120
#define ERROR(name)
Definition: error_private.h:53
static BOOL FASTCALL REGION_XorRegion(PREGION dr, PREGION sra, PREGION srb)
Definition: region.c:1768
#define RGN_AND
Definition: wingdi.h:355
unsigned int BOOL
Definition: ntddk_ex.h:94
#define RGN_XOR
Definition: wingdi.h:359
smooth NULL
Definition: ftsmooth.c:416
#define RGN_OR
Definition: wingdi.h:358
void DPRINT(...)
Definition: polytest.cpp:61
static BOOL FASTCALL REGION_UnionRegion(PREGION newReg, PREGION reg1, PREGION reg2)
Definition: region.c:1478
static BOOL FASTCALL REGION_SubtractRegion(PREGION regD, PREGION regM, PREGION regS)
Definition: region.c:1732
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define RGN_COPY
Definition: wingdi.h:356
#define RGN_DIFF
Definition: wingdi.h:357
#define DPRINT1
Definition: precomp.h:8
INT FASTCALL REGION_Complexity(PREGION prgn)
Definition: region.c:567
static BOOL FASTCALL REGION_IntersectRegion(PREGION newReg, PREGION reg1, PREGION reg2)
Definition: region.c:1306

Referenced by CLIPPING_UpdateGCRegion(), co_IntGetUpdateRgn(), co_UserRedrawWindow(), co_VIS_WindowLayoutChanged(), co_WinPosSetWindowPos(), DC_vCopyState(), DceUpdateVisRgn(), GdiSelectVisRgn(), IntGdiBitBltRgn(), IntGdiExtSelectClipRgn(), IntGdiFillRgn(), IntGdiSetMetaRgn(), IntInvalidateWindows(), IntScrollWindowEx(), IntValidateParents(), NtGdiCombineRgn(), NtGdiGetRandomRgn(), REGION_LPTODP(), UserScrollDC(), and VIS_ComputeVisibleRegion().

◆ IntGdiGetRgnBox()

INT APIENTRY IntGdiGetRgnBox ( HRGN  ,
RECTL  
)

◆ IntGdiSetRegionOwner()

BOOL FASTCALL IntGdiSetRegionOwner ( HRGN  ,
DWORD   
)

Definition at line 2481 of file region.c.

2482 {
2483  PREGION prgn;
2484  PRGN_ATTR prgnattr;
2485  PPROCESSINFO ppi;
2486 
2487  prgn = REGION_LockRgn(hRgn);
2488  if (prgn == NULL)
2489  {
2490  return FALSE;
2491  }
2492 
2493  prgnattr = prgn->prgnattr;
2494  if (prgnattr != &prgn->rgnattr)
2495  {
2497  prgn->prgnattr = &prgn->rgnattr;
2499  GdiPoolFree(ppi->pPoolRgnAttr, prgnattr);
2500  }
2501 
2502  REGION_UnlockRgn(prgn);
2503 
2504  return GreSetObjectOwner(hRgn, OwnerMask);
2505 }
BASEOBJECT BaseObject
Definition: region.h:11
BOOL NTAPI GreSetObjectOwner(HGDIOBJ hobj, ULONG ulOwner)
Definition: gdiobj.c:1250
VOID NTAPI GdiPoolFree(PGDI_POOL pPool, PVOID pvAlloc)
Definition: gdipool.c:233
static HRGN hRgn
Definition: mapping.c:33
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2380
_Notnull_ PRGN_ATTR prgnattr
Definition: region.h:12
smooth NULL
Definition: ftsmooth.c:416
Definition: region.h:7
RGN_ATTR rgnattr
Definition: region.h:13
VOID NTAPI GDIOBJ_vSetObjectAttr(POBJ pobj, PVOID pvObjAttr)
Definition: gdiobj.c:1091
struct _GDI_POOL * pPoolRgnAttr
Definition: win32.h:284
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2395

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

◆ IntRectInRegion()

BOOL FASTCALL IntRectInRegion ( HRGN  ,
LPRECTL   
)

Definition at line 3510 of file region.c.

3513 {
3514  PREGION Rgn;
3515  BOOL Ret;
3516 
3517  Rgn = REGION_LockRgn(hRgn);
3518  if (Rgn == NULL)
3519  {
3520  return ERROR;
3521  }
3522 
3523  Ret = REGION_RectInRegion(Rgn, rc);
3524  REGION_UnlockRgn(Rgn);
3525  return Ret;
3526 }
#define ERROR(name)
Definition: error_private.h:53
static HRGN hRgn
Definition: mapping.c:33
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2380
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL FASTCALL REGION_RectInRegion(PREGION Rgn, const RECTL *rect)
Definition: region.c:2628
Definition: region.h:7
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2395

Referenced by NtGdiRectInRegion().

◆ IntSysCreateRectpRgn()

PREGION FASTCALL IntSysCreateRectpRgn ( INT  ,
INT  ,
INT  ,
INT   
)

Definition at line 2429 of file region.c.

2434 {
2435  PREGION prgn;
2436 
2437  /* Allocate a region, without a handle */
2439  if (prgn == NULL)
2440  {
2441  return NULL;
2442  }
2443 
2444  /* Initialize it */
2445  prgn->Buffer = &prgn->rdh.rcBound;
2446  prgn->prgnattr = &prgn->rgnattr;
2448  REGION_SetRectRgn(prgn, LeftRect, TopRect, RightRect, BottomRect);
2449 
2450  return prgn;
2451 }
#define ATTR_RGN_VALID
Definition: ntgdihdl.h:206
_Notnull_ PRGN_ATTR prgnattr
Definition: region.h:12
RECTL * Buffer
Definition: region.h:16
smooth NULL
Definition: ftsmooth.c:416
Definition: region.h:7
ULONG AttrFlags
Definition: ntgdihdl.h:265
RGN_ATTR rgnattr
Definition: region.h:13
RGNDATAHEADER rdh
Definition: region.h:15
struct _REGION * PREGION
VOID FASTCALL REGION_SetRectRgn(PREGION rgn, INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2688
POBJ NTAPI GDIOBJ_AllocateObject(UCHAR objt, ULONG cjSize, FLONG fl)
Definition: gdiobj.c:557

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

◆ REGION_AllocRgnWithHandle()

PREGION FASTCALL REGION_AllocRgnWithHandle ( INT  n)

Definition at line 2222 of file region.c.

2224 {
2225  //HRGN hReg;
2226  PREGION pReg;
2227 
2229  sizeof(REGION),
2231  if (pReg == NULL)
2232  {
2233  DPRINT1("Could not allocate a palette.\n");
2234  return NULL;
2235  }
2236 
2237  //hReg = pReg->BaseObject.hHmgr;
2238 
2239  if ((nReg == 0) || (nReg == 1))
2240  {
2241  /* Testing shows that > 95% of all regions have only 1 rect.
2242  Including that here saves us from having to do another allocation */
2243  pReg->Buffer = &pReg->rdh.rcBound;
2244  }
2245  else
2246  {
2248  nReg * sizeof(RECT),
2249  TAG_REGION);
2250  if (pReg->Buffer == NULL)
2251  {
2252  DPRINT1("Could not allocate region buffer\n");
2254  return NULL;
2255  }
2256  }
2257 
2258  EMPTY_REGION(pReg);
2259  pReg->rdh.dwSize = sizeof(RGNDATAHEADER);
2260  pReg->rdh.nCount = nReg;
2261  pReg->rdh.nRgnSize = nReg * sizeof(RECT);
2262  pReg->prgnattr = &pReg->rgnattr;
2263 
2264  /* Initialize the region attribute */
2265  pReg->rgnattr.AttrFlags = 0;
2267  pReg->rgnattr.Rect = pReg->rdh.rcBound;
2268 
2269  /* Finally insert the region into the handle table */
2271  {
2272  DPRINT1("Could not insert palette into handle table.\n");
2274  return NULL;
2275  }
2276 
2277  return pReg;
2278 }
BASEOBJECT BaseObject
Definition: region.h:11
struct _RGNDATAHEADER RGNDATAHEADER
#define TAG_REGION
Definition: tags.h:22
struct tagRECT RECT
_Notnull_ PRGN_ATTR prgnattr
Definition: region.h:12
RECTL * Buffer
Definition: region.h:16
smooth NULL
Definition: ftsmooth.c:416
Definition: region.h:7
ULONG AttrFlags
Definition: ntgdihdl.h:265
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1106
RGN_ATTR rgnattr
Definition: region.h:13
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
ULONG iComplexity
Definition: ntgdihdl.h:266
RGNDATAHEADER rdh
Definition: region.h:15
#define SIMPLEREGION
Definition: wingdi.h:361
#define EMPTY_REGION(pReg)
Definition: region.c:149
#define DPRINT1
Definition: precomp.h:8
RECTL Rect
Definition: ntgdihdl.h:267
struct _REGION * PREGION
POBJ NTAPI GDIOBJ_AllocateObject(UCHAR objt, ULONG cjSize, FLONG fl)
Definition: gdiobj.c:557
VOID NTAPI GDIOBJ_vFreeObject(POBJ pobj)
Definition: gdiobj.c:591
HGDIOBJ NTAPI GDIOBJ_hInsertObject(POBJ pobj, ULONG ulOwner)
Definition: gdiobj.c:907

Referenced by REGION_AllocUserRgnWithHandle(), and REGION_XorRegion().

◆ REGION_AllocUserRgnWithHandle()

PREGION FASTCALL REGION_AllocUserRgnWithHandle ( INT  n)

Definition at line 2316 of file region.c.

2318 {
2319  PREGION prgn;
2320 
2321  prgn = REGION_AllocRgnWithHandle(nRgn);
2322  if (prgn == NULL)
2323  {
2324  return NULL;
2325  }
2326 
2327  if (!REGION_bAllocRgnAttr(prgn))
2328  {
2329  ASSERT(FALSE);
2330  }
2331 
2332  return prgn;
2333 }
smooth NULL
Definition: ftsmooth.c:416
Definition: region.h:7
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOL NTAPI REGION_bAllocRgnAttr(PREGION prgn)
Definition: region.c:2282
PREGION FASTCALL REGION_AllocRgnWithHandle(INT nReg)
Definition: region.c:2222

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

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

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

2085 {
2086  XFORMOBJ xo;
2087  ULONG i, j, 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! */
2127  NT_ASSERT(FALSE);
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  for (j = i; i < prgn->rdh.nCount; i++)
2153  {
2154  NT_ASSERT(prgn->Buffer[i].top < prgn->Buffer[i].bottom);
2155  NT_ASSERT(prgn->Buffer[j].top >= prgn->Buffer[i].top);
2156  }
2157  }
2158 
2159  return TRUE;
2160  }
2161  }
2162  else
2163  {
2164  /* Allocate a buffer for the polygons */
2165  cjSize = prgn->rdh.nCount * (4 * sizeof(POINT) + sizeof(ULONG));
2167  if (ppt == NULL)
2168  {
2169  return FALSE;
2170  }
2171 
2172  /* Fill the buffer with the rects */
2173  pcPoints = (PULONG)&ppt[4 * prgn->rdh.nCount];
2174  for (i = 0; i < prgn->rdh.nCount; i++)
2175  {
2176  /* Make sure the rect is within the legal range */
2177  pcPoints[i] = 4;
2178  ppt[4 * i + 0].x = prgn->Buffer[i].left;
2179  ppt[4 * i + 0].y = prgn->Buffer[i].top;
2180  ppt[4 * i + 1].x = prgn->Buffer[i].right;
2181  ppt[4 * i + 1].y = prgn->Buffer[i].top;
2182  ppt[4 * i + 2].x = prgn->Buffer[i].right;
2183  ppt[4 * i + 2].y = prgn->Buffer[i].bottom;
2184  ppt[4 * i + 3].x = prgn->Buffer[i].left;
2185  ppt[4 * i + 3].y = prgn->Buffer[i].bottom;
2186  }
2187 
2188  /* Initialize the xform object */
2189  XFORMOBJ_vInit(&xo, pmx);
2190 
2191  /* Apply the xform to the rects in the buffer */
2192  if (!XFORMOBJ_bApplyXform(&xo,
2193  XF_LTOL,
2194  prgn->rdh.nCount * 2,
2195  ppt,
2196  ppt))
2197  {
2198  /* This means, there were coordinates that would go outside of
2199  the coordinate space after the transformation */
2201  return FALSE;
2202  }
2203 
2204  /* Now use the polygons to create a polygon region */
2205  bResult = REGION_SetPolyPolygonRgn(prgn,
2206  ppt,
2207  pcPoints,
2208  prgn->rdh.nCount,
2209  WINDING);
2210 
2211  /* Free the polygon buffer */
2213 
2214  return bResult;
2215  }
2216 
2217 }
#define WINDING
Definition: constants.h:279
#define TRUE
Definition: types.h:120
BOOL FASTCALL REGION_SetPolyPolygonRgn(_Inout_ PREGION prgn, _In_ const POINT *ppt, _In_ const ULONG *pcPoints, _In_ ULONG cPolygons, _In_ INT iMode)
Definition: region.c:3278
long y
Definition: polytest.cpp:48
FORCEINLINE VOID RECTL_vSetEmptyRect(_Out_ RECTL *prcl)
Definition: rect.h:20
#define XFORMOBJ_bApplyXform
Definition: xformobj.h:11
long x
Definition: polytest.cpp:48
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2730
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
& rect
Definition: startmenu.cpp:1413
#define GDITAG_REGION
Definition: tags.h:157
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 BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define POINT
Definition: precomp.h:30
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 XF_LTOL
Definition: winddi.h:3109
BOOL FASTCALL RECTL_bUnionRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:18
#define for
Definition: utility.h:88
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned int * PULONG
Definition: retypes.h:1
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG cjSize
Definition: winddi.h:3634
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
#define NT_ASSERT
Definition: rtlfuncs.h:3312

Referenced by REGION_LPTODP().

◆ REGION_Complexity()

INT FASTCALL REGION_Complexity ( PREGION  )

Definition at line 567 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:
580  return COMPLEXREGION;
581  }
582 }
#define COMPLEXREGION
Definition: wingdi.h:362
#define NULLREGION
Definition: wingdi.h:360
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define SIMPLEREGION
Definition: wingdi.h:361

Referenced by co_WinPosSetWindowPos(), 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 678 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;
688  INT bottom = MINLONG;
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 
794 empty:
795  if (rgnDst->Buffer == NULL)
796  {
797  rgnDst->Buffer = &rgnDst->rdh.rcBound;
798  }
799 
800  EMPTY_REGION(rgnDst);
801  return NULLREGION;
802 }
#define max(a, b)
Definition: svc.c:63
#define MAXLONG
Definition: umtypes.h:116
#define ERROR(name)
Definition: error_private.h:53
static const WCHAR empty[]
Definition: main.c:49
#define TAG_REGION
Definition: tags.h:22
#define NULLREGION
Definition: wingdi.h:360
LONG top
Definition: windef.h:292
long bottom
Definition: polytest.cpp:53
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
long right
Definition: polytest.cpp:53
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
long top
Definition: polytest.cpp:53
RECTL * Buffer
Definition: region.h:16
smooth NULL
Definition: ftsmooth.c:416
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
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 EXTENTCHECK(r1, r2)
Definition: region.c:167
#define RDH_RECTANGLES
Definition: wingdi.h:668
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define MINLONG
Definition: umtypes.h:115
RGNDATAHEADER rdh
Definition: region.h:15
#define EMPTY_REGION(pReg)
Definition: region.c:149
static calc_node_t temp
Definition: rpn_ieee.c:38
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
LONG bottom
Definition: windef.h:294
INT FASTCALL REGION_Complexity(PREGION prgn)
Definition: region.c:567
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by NtGdiIntersectClipRect().

◆ REGION_Delete()

◆ REGION_GetRgnBox()

INT FASTCALL REGION_GetRgnBox ( PREGION  Rgn,
RECTL pRect 
)

◆ REGION_LockRgn()

PREGION FASTCALL REGION_LockRgn ( _In_ HRGN  hrgn)

◆ REGION_PtInRegion()

BOOL FASTCALL REGION_PtInRegion ( PREGION  ,
INT  ,
INT   
)

Definition at line 2605 of file region.c.

2609 {
2610  ULONG i;
2611  PRECT r;
2612 
2613  if (prgn->rdh.nCount > 0 && INRECT(prgn->rdh.rcBound, X, Y))
2614  {
2615  r = prgn->Buffer;
2616  for (i = 0; i < prgn->rdh.nCount; i++)
2617  {
2618  if (INRECT(r[i], X, Y))
2619  return TRUE;
2620  }
2621  }
2622 
2623  return FALSE;
2624 }
#define TRUE
Definition: types.h:120
#define Y(I)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
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
#define INRECT(r, x, y)
Definition: region.c:158
unsigned int ULONG
Definition: retypes.h:1

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

◆ REGION_RectInRegion()

BOOL FASTCALL REGION_RectInRegion ( PREGION  Rgn,
const RECTL rc 
)

Definition at line 2628 of file region.c.

2631 {
2632  PRECTL pCurRect, pRectEnd;
2633  RECT rc;
2634 
2635  /* Swap the coordinates to make right >= left and bottom >= top */
2636  /* (region building rectangles are normalized the same way) */
2637  if (rect->top > rect->bottom)
2638  {
2639  rc.top = rect->bottom;
2640  rc.bottom = rect->top;
2641  }
2642  else
2643  {
2644  rc.top = rect->top;
2645  rc.bottom = rect->bottom;
2646  }
2647 
2648  if (rect->right < rect->left)
2649  {
2650  rc.right = rect->left;
2651  rc.left = rect->right;
2652  }
2653  else
2654  {
2655  rc.right = rect->right;
2656  rc.left = rect->left;
2657  }
2658 
2659  /* This is (just) a useful optimization */
2660  if ((Rgn->rdh.nCount > 0) && EXTENTCHECK(&Rgn->rdh.rcBound, &rc))
2661  {
2662  for (pCurRect = Rgn->Buffer, pRectEnd = pCurRect +
2663  Rgn->rdh.nCount; pCurRect < pRectEnd; pCurRect++)
2664  {
2665  if (pCurRect->bottom <= rc.top)
2666  continue; /* Not far enough down yet */
2667 
2668  if (pCurRect->top >= rc.bottom)
2669  break; /* Too far down */
2670 
2671  if (pCurRect->right <= rc.left)
2672  continue; /* Not far enough over yet */
2673 
2674  if (pCurRect->left >= rc.right)
2675  {
2676  continue;
2677  }
2678 
2679  return TRUE;
2680  }
2681  }
2682 
2683  return FALSE;
2684 }
#define TRUE
Definition: types.h:120
LONG top
Definition: windef.h:292
long bottom
Definition: polytest.cpp:53
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
& rect
Definition: startmenu.cpp:1413
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
RECTL * Buffer
Definition: region.h:16
long left
Definition: polytest.cpp:53
#define EXTENTCHECK(r1, r2)
Definition: region.c:167
RGNDATAHEADER rdh
Definition: region.h:15
LONG bottom
Definition: windef.h:294

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

3284 {
3285  EDGE_TABLE_ENTRY *pAET; /* Active Edge Table */
3286  INT y; /* Current scanline */
3287  INT iPts = 0; /* Number of pts in buffer */
3288  EDGE_TABLE_ENTRY *pWETE; /* Winding Edge Table Entry */
3289  SCANLINE_LIST *pSLL; /* Current SCANLINE_LIST */
3290  POINT *pts; /* Output buffer */
3291  EDGE_TABLE_ENTRY *pPrevAET; /* Pointer to previous AET */
3292  EDGE_TABLE ET; /* Header node for ET */
3293  EDGE_TABLE_ENTRY AET; /* Header node for AET */
3294  EDGE_TABLE_ENTRY *pETEs; /* EDGE_TABLEEntries pool */
3295  SCANLINE_LISTBLOCK SLLBlock; /* Header for SCANLINE_LIST */
3296  INT fixWAET = FALSE;
3297  POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers */
3298  POINTBLOCK *tmpPtBlock;
3299  UINT numFullPtBlocks = 0;
3300  UINT poly, total;
3301 
3302  /* Check if iMode is valid */
3303  if ((iMode != ALTERNATE) && (iMode != WINDING))
3304  {
3305  DPRINT1("Invalid iMode: %lu\n", iMode);
3306  return FALSE;
3307  }
3308 
3309  /* Special case a rectangle */
3310  if (((cPolygons == 1) && ((pcPoints[0] == 4) ||
3311  ((pcPoints[0] == 5) && (ppt[4].x == ppt[0].x) && (ppt[4].y == ppt[0].y)))) &&
3312  (((ppt[0].y == ppt[1].y) &&
3313  (ppt[1].x == ppt[2].x) &&
3314  (ppt[2].y == ppt[3].y) &&
3315  (ppt[3].x == ppt[0].x)) ||
3316  ((ppt[0].x == ppt[1].x) &&
3317  (ppt[1].y == ppt[2].y) &&
3318  (ppt[2].x == ppt[3].x) &&
3319  (ppt[3].y == ppt[0].y))))
3320  {
3321  REGION_SetRectRgn(prgn,
3322  min(ppt[0].x, ppt[2].x),
3323  min(ppt[0].y, ppt[2].y),
3324  max(ppt[0].x, ppt[2].x),
3325  max(ppt[0].y, ppt[2].y));
3326  return TRUE;
3327  }
3328 
3329  for (poly = total = 0; poly < cPolygons; poly++)
3330  total += pcPoints[poly];
3331 
3333  sizeof(EDGE_TABLE_ENTRY) * total,
3334  TAG_REGION);
3335  if (pETEs == NULL)
3336  {
3337  DPRINT1("Failed to allocate %lu edge entries\n", total);
3338  return FALSE;
3339  }
3340 
3341  pts = FirstPtBlock.pts;
3342  REGION_CreateETandAET(pcPoints, cPolygons, ppt, &ET, &AET, pETEs, &SLLBlock);
3343  pSLL = ET.scanlines.next;
3344  curPtBlock = &FirstPtBlock;
3345 
3346  if (iMode != WINDING)
3347  {
3348  /* For each scanline */
3349  for (y = ET.ymin; y < ET.ymax; y++)
3350  {
3351  /* Add a new edge to the active edge table when we
3352  * get to the next edge. */
3353  if (pSLL != NULL && y == pSLL->scanline)
3354  {
3355  REGION_loadAET(&AET, pSLL->edgelist);
3356  pSLL = pSLL->next;
3357  }
3358  pPrevAET = &AET;
3359  pAET = AET.next;
3360 
3361  /* For each active edge */
3362  while (pAET)
3363  {
3364  pts->x = pAET->bres.minor_axis, pts->y = y;
3365  pts++, iPts++;
3366 
3367  /* Send out the buffer */
3368  if (iPts == NUMPTSTOBUFFER)
3369  {
3370  tmpPtBlock = ExAllocatePoolWithTag(PagedPool,
3371  sizeof(POINTBLOCK),
3372  TAG_REGION);
3373  if (tmpPtBlock == NULL)
3374  {
3375  DPRINT1("Can't alloc tmpPtBlock\n");
3376  ExFreePoolWithTag(pETEs, TAG_REGION);
3377  return FALSE;
3378  }
3379 
3380  curPtBlock->next = tmpPtBlock;
3381  curPtBlock = tmpPtBlock;
3382  pts = curPtBlock->pts;
3383  numFullPtBlocks++;
3384  iPts = 0;
3385  }
3386 
3387  EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
3388  }
3389 
3390  REGION_InsertionSort(&AET);
3391  }
3392  }
3393  else
3394  {
3395  /* For each scanline */
3396  for (y = ET.ymin; y < ET.ymax; y++)
3397  {
3398  /* Add a new edge to the active edge table when we
3399  * get to the next edge. */
3400  if (pSLL != NULL && y == pSLL->scanline)
3401  {
3402  REGION_loadAET(&AET, pSLL->edgelist);
3403  REGION_computeWAET(&AET);
3404  pSLL = pSLL->next;
3405  }
3406 
3407  pPrevAET = &AET;
3408  pAET = AET.next;
3409  pWETE = pAET;
3410 
3411  /* For each active edge */
3412  while (pAET)
3413  {
3414  /* Add to the buffer only those edges that
3415  * are in the Winding active edge table. */
3416  if (pWETE == pAET)
3417  {
3418  pts->x = pAET->bres.minor_axis;
3419  pts->y = y;
3420  pts++;
3421  iPts++;
3422 
3423  /* Send out the buffer */
3424  if (iPts == NUMPTSTOBUFFER)
3425  {
3426  tmpPtBlock = ExAllocatePoolWithTag(PagedPool,
3427  sizeof(POINTBLOCK),
3428  TAG_REGION);
3429  if (tmpPtBlock == NULL)
3430  {
3431  DPRINT1("Can't alloc tPB\n");
3432  ExFreePoolWithTag(pETEs, TAG_REGION);
3433  return FALSE;
3434  }
3435  curPtBlock->next = tmpPtBlock;
3436  curPtBlock = tmpPtBlock;
3437  pts = curPtBlock->pts;
3438  numFullPtBlocks++;
3439  iPts = 0;
3440  }
3441 
3442  pWETE = pWETE->nextWETE;
3443  }
3444 
3445  EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
3446  }
3447 
3448  /* Recompute the winding active edge table if
3449  * we just resorted or have exited an edge. */
3450  if (REGION_InsertionSort(&AET) || fixWAET)
3451  {
3452  REGION_computeWAET(&AET);
3453  fixWAET = FALSE;
3454  }
3455  }
3456  }
3457 
3458  REGION_FreeStorage(SLLBlock.next);
3459  REGION_PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, prgn);
3460 
3461  for (curPtBlock = FirstPtBlock.next; numFullPtBlocks-- > 0;)
3462  {
3463  tmpPtBlock = curPtBlock->next;
3464  ExFreePoolWithTag(curPtBlock, TAG_REGION);
3465  curPtBlock = tmpPtBlock;
3466  }
3467 
3468  ExFreePoolWithTag(pETEs, TAG_REGION);
3469  return TRUE;
3470 }
#define max(a, b)
Definition: svc.c:63
#define WINDING
Definition: constants.h:279
#define TRUE
Definition: types.h:120
static VOID FASTCALL REGION_loadAET(EDGE_TABLE_ENTRY *AET, EDGE_TABLE_ENTRY *ETEs)
Definition: region.c:2907
long y
Definition: polytest.cpp:48
_In_ ULONG iMode
Definition: winddi.h:3520
long x
Definition: polytest.cpp:48
EDGE_TABLE_ENTRY * edgelist
Definition: region.c:331
#define TAG_REGION
Definition: tags.h:22
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
struct _SCANLINE_LIST * next
Definition: region.c:332
Definition: bidi.c:79
int32_t INT
Definition: typedefs.h:56
struct _POINTBLOCK * next
Definition: region.c:532
static INT FASTCALL REGION_PtsToRegion(INT numFullPtBlocks, INT iCurPtBlock, POINTBLOCK *FirstPtBlock, PREGION reg)
Definition: region.c:3066
struct _EDGE_TABLE_ENTRY * nextWETE
Definition: region.c:323
#define ALTERNATE
Definition: constants.h:278
smooth NULL
Definition: ftsmooth.c:416
Definition: region.c:317
INT minor_axis
Definition: region.c:249
POINT pts[NUMPTSTOBUFFER]
Definition: region.c:531
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:3192
struct _SCANLINE_LISTBLOCK * next
Definition: region.c:354
static VOID FASTCALL REGION_computeWAET(EDGE_TABLE_ENTRY *AET)
Definition: region.c:2960
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static BOOL FASTCALL REGION_InsertionSort(EDGE_TABLE_ENTRY *AET)
Definition: region.c:3001
#define NUMPTSTOBUFFER
Definition: region.c:524
#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
Definition: region.c:393
static VOID FASTCALL REGION_FreeStorage(SCANLINE_LISTBLOCK *pSLLBlock)
Definition: region.c:3044
BRESINFO bres
Definition: region.c:320
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define DPRINT1
Definition: precomp.h:8
INT scanline
Definition: region.c:330
#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET)
Definition: region.c:370
struct _EDGE_TABLE_ENTRY * next
Definition: region.c:321
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
VOID FASTCALL REGION_SetRectRgn(PREGION rgn, INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2688

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

2694 {
2695  PRECTL firstRect;
2696 
2697  if (LeftRect > RightRect)
2698  {
2699  INT tmp = LeftRect;
2700  LeftRect = RightRect;
2701  RightRect = tmp;
2702  }
2703 
2704  if (TopRect > BottomRect)
2705  {
2706  INT tmp = TopRect;
2707  TopRect = BottomRect;
2708  BottomRect = tmp;
2709  }
2710 
2711  if ((LeftRect != RightRect) && (TopRect != BottomRect))
2712  {
2713  firstRect = rgn->Buffer;
2714  ASSERT(firstRect);
2715  firstRect->left = rgn->rdh.rcBound.left = LeftRect;
2716  firstRect->top = rgn->rdh.rcBound.top = TopRect;
2717  firstRect->right = rgn->rdh.rcBound.right = RightRect;
2718  firstRect->bottom = rgn->rdh.rcBound.bottom = BottomRect;
2719  rgn->rdh.nCount = 1;
2720  rgn->rdh.iType = RDH_RECTANGLES;
2721  }
2722  else
2723  {
2724  EMPTY_REGION(rgn);
2725  }
2726 }
long bottom
Definition: polytest.cpp:53
int32_t INT
Definition: typedefs.h:56
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
#define RDH_RECTANGLES
Definition: wingdi.h:668
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define EMPTY_REGION(pReg)
Definition: region.c:149

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 1827 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;
1838  REGION_SubtractRegion(prgnDest, prgnSrc, &rgnLocal);
1839  return REGION_Complexity(prgnDest);
1840 }
struct tagRECT RECT
RECTL * Buffer
Definition: region.h:16
Definition: region.h:7
static BOOL FASTCALL REGION_SubtractRegion(PREGION regD, PREGION regM, PREGION regS)
Definition: region.c:1732
RGNDATAHEADER rdh
Definition: region.h:15
_In_ ULONG _In_ CLIPOBJ _In_ RECTL * prcl
Definition: winddi.h:3529
INT FASTCALL REGION_Complexity(PREGION prgn)
Definition: region.c:567

Referenced by NtGdiExcludeClipRect().

◆ REGION_UnionRectWithRgn()

BOOL FASTCALL REGION_UnionRectWithRgn ( PREGION  rgn,
const RECTL rect 
)

Adds a rectangle to a REGION

Definition at line 1812 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);
1821  region.rdh.rcBound = *rect;
1822  return REGION_UnionRegion(rgn, rgn, &region);
1823 }
& rect
Definition: startmenu.cpp:1413
struct tagRECT RECT
RECTL * Buffer
Definition: region.h:16
Definition: region.h:7
static BOOL FASTCALL REGION_UnionRegion(PREGION newReg, PREGION reg1, PREGION reg2)
Definition: region.c:1478
RGNDATAHEADER rdh
Definition: region.h:15

Referenced by NtGdiExtCreateRegion().

◆ REGION_UnlockRgn()

VOID FASTCALL REGION_UnlockRgn ( _In_ PREGION  prgn)

Definition at line 2395 of file region.c.

2397 {
2398  PRGN_ATTR prgnattr;
2399 
2400  NT_ASSERT(prgn != NULL);
2401  NT_ASSERT(prgn->prgnattr != NULL);
2402 
2403  /* Get the region attribute and check if it's user mode */
2404  prgnattr = prgn->prgnattr;
2405  if (prgnattr != &prgn->rgnattr)
2406  {
2407  NT_ASSERT(GreGetObjectOwner(prgn->BaseObject.hHmgr) == GDI_OBJ_HMGR_POWNED);
2408  prgnattr->iComplexity = REGION_Complexity(prgn);
2409  prgnattr->Rect.left = prgn->rdh.rcBound.left;
2410  prgnattr->Rect.top = prgn->rdh.rcBound.top;
2411  prgnattr->Rect.right = prgn->rdh.rcBound.right;
2412  prgnattr->Rect.bottom = prgn->rdh.rcBound.bottom;
2413  prgnattr->AttrFlags |= ATTR_RGN_VALID;
2414  }
2415 
2416  GDIOBJ_vUnlockObject(&prgn->BaseObject);
2417 }
long bottom
Definition: polytest.cpp:53
ULONG NTAPI GreGetObjectOwner(HGDIOBJ hobj)
Definition: gdiobj.c:1187
#define ATTR_RGN_VALID
Definition: ntgdihdl.h:206
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
smooth NULL
Definition: ftsmooth.c:416
ULONG AttrFlags
Definition: ntgdihdl.h:265
long left
Definition: polytest.cpp:53
VOID NTAPI GDIOBJ_vUnlockObject(POBJ pobj)
Definition: gdiobj.c:875
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
ULONG iComplexity
Definition: ntgdihdl.h:266
RECTL Rect
Definition: ntgdihdl.h:267
INT FASTCALL REGION_Complexity(PREGION prgn)
Definition: region.c:567
#define NT_ASSERT
Definition: rtlfuncs.h:3312

Referenced by _Success_(), co_IntGetUpdateRgn(), co_WinPosSetWindowPos(), DceUpdateVisRgn(), 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 2455 of file region.c.

2456 {
2457  PREGION pRgn = (PREGION)ObjectBody;
2459  ASSERT(ppi);
2460 
2461  ASSERT(pRgn->prgnattr);
2462  if (pRgn->prgnattr != &pRgn->rgnattr)
2463  GdiPoolFree(ppi->pPoolRgnAttr, pRgn->prgnattr);
2464 
2465  if (pRgn->Buffer && pRgn->Buffer != &pRgn->rdh.rcBound)
2467 }
VOID NTAPI GdiPoolFree(PGDI_POOL pPool, PVOID pvAlloc)
Definition: gdipool.c:233
#define TAG_REGION
Definition: tags.h:22
_Notnull_ PRGN_ATTR prgnattr
Definition: region.h:12
RECTL * Buffer
Definition: region.h:16
Definition: region.h:7
RGN_ATTR rgnattr
Definition: region.h:13
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
RGNDATAHEADER rdh
Definition: region.h:15
struct _GDI_POOL * pPoolRgnAttr
Definition: win32.h:284
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
struct _REGION * PREGION
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Variable Documentation

◆ hrgnDefault

HRGN hrgnDefault

Definition at line 131 of file region.c.

◆ prgnDefault

PREGION prgnDefault

Definition at line 130 of file region.c.

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