Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

rect.c File Reference

Go to the source code of this file.

Defines

#define VALIDATERECT(prc, retval)   if (prc == NULL) return retval

Functions

BOOL APIENTRY SetRect (LPRECT prc, int left, int top, int right, int bottom)
BOOL APIENTRY CopyInflateRect (LPRECT prcDst, CONST RECT *prcSrc, int cx, int cy)
BOOL APIENTRY CopyOffsetRect (LPRECT prcDst, CONST RECT *prcSrc, int cx, int cy)
BOOL APIENTRY IsRectEmpty (CONST RECT *prc)
BOOL APIENTRY PtInRect (CONST RECT *prc, POINT pt)
BOOL APIENTRY OffsetRect (LPRECT prc, int cx, int cy)
BOOL APIENTRY InflateRect (LPRECT prc, int cx, int cy)
BOOL APIENTRY IntersectRect (LPRECT prcDst, CONST RECT *prcSrc1, CONST RECT *prcSrc2)
BOOL APIENTRY UnionRect (LPRECT prcDst, CONST RECT *prcSrc1, CONST RECT *prcSrc2)
BOOL APIENTRY EqualRect (CONST RECT *prc1, CONST RECT *prc2)
BOOL APIENTRY SubtractRect (LPRECT prcDst, CONST RECT *prcSrc1, CONST RECT *prcSrc2)
BOOL APIENTRY CopyRect (LPRECT prcDst, CONST RECT *prcSrc)
BOOL APIENTRY SetRectEmpty (LPRECT prc)
void RECTFromSIZERECT (PRECT prc, PCSIZERECT psrc)
void SIZERECTFromRECT (PSIZERECT psrc, LPCRECT prc)


Define Documentation

#define VALIDATERECT prc,
retval   )     if (prc == NULL) return retval
 

Definition at line 15 of file rect.c.

Referenced by CopyRect(), EqualRect(), InflateRect(), IntersectRect(), IsRectEmpty(), OffsetRect(), PtInRect(), SetRect(), SetRectEmpty(), SubtractRect(), and UnionRect().


Function Documentation

BOOL APIENTRY CopyInflateRect LPRECT  prcDst,
CONST RECT *  prcSrc,
int  cx,
int  cy
 

Definition at line 52 of file rect.c.

References APIENTRY, BOOL, cy, and TRUE.

Referenced by DefFrameProcWorker(), FindNCHit(), MNItemHitTest(), SLScrollText(), xxxCalcCaptionButton(), xxxCBInternalUpdateEditWindow(), xxxHelpLoop(), xxxLBSize(), xxxMetricsRecalc(), and xxxPaintSwitchWindow().

00056 { 00057 prcDst->left = prcSrc->left - cx; 00058 prcDst->right = prcSrc->right + cx; 00059 prcDst->top = prcSrc->top - cy; 00060 prcDst->bottom = prcSrc->bottom + cy; 00061 return TRUE; 00062 }

BOOL APIENTRY CopyOffsetRect LPRECT  prcDst,
CONST RECT *  prcSrc,
int  cx,
int  cy
 

Definition at line 73 of file rect.c.

References APIENTRY, BOOL, cy, and TRUE.

Referenced by NormalizeRect(), PreventInterMonitorBlts(), TooltipRender(), xxxMNOpenHierarchy(), xxxMS_TrackMove(), and xxxScrollWindowEx().

00077 { 00078 prcDst->left = prcSrc->left + cx; 00079 prcDst->right = prcSrc->right + cx; 00080 prcDst->top = prcSrc->top + cy; 00081 prcDst->bottom = prcSrc->bottom + cy; 00082 return TRUE; 00083 }

BOOL APIENTRY CopyRect LPRECT  prcDst,
CONST RECT *  prcSrc
 

Definition at line 404 of file rect.c.

References APIENTRY, BOOL, FALSE, TRUE, and VALIDATERECT.

00407 { 00408 VALIDATERECT(prcDst, FALSE); 00409 VALIDATERECT(prcSrc, FALSE); 00410 00411 *prcDst = *prcSrc; 00412 return TRUE; 00413 }

BOOL APIENTRY EqualRect CONST RECT *  prc1,
CONST RECT *  prc2
 

Definition at line 295 of file rect.c.

References APIENTRY, BOOL, FALSE, and VALIDATERECT.

00298 { 00299 VALIDATERECT(prc1, FALSE); 00300 VALIDATERECT(prc2, FALSE); 00301 00302 /* 00303 * Test equality only. This is what win31 does. win31 does not check to 00304 * see if the rectangles are "empty" first. 00305 */ 00306 return RtlEqualMemory(prc1, prc2, sizeof(RECT)); 00307 }

BOOL APIENTRY InflateRect LPRECT  prc,
int  cx,
int  cy
 

Definition at line 165 of file rect.c.

References APIENTRY, BOOL, cy, FALSE, TRUE, and VALIDATERECT.

Referenced by _AdjustWindowRectEx(), BNCalcRect(), BNMultiExtent(), ECInvalidateClient(), ECSetEditClip(), ECSize(), EndTaskDlgProc(), FindNCHit(), MLPaint(), MNDrawFullNC(), msProfMove(), msProfSize(), NormalizeRect(), SetEndTaskDlgStatus(), SLDrawLine(), xxxBNDrawText(), xxxCalcCaptionButton(), xxxCalcClientRect(), xxxCBCreateHandler(), xxxCBInternalUpdateEditWindow(), xxxDrawButton(), xxxDrawCaptionBar(), xxxDrawWindowFrame(), xxxGetTitleBarInfo(), xxxHandleMenuMessages(), xxxInitSendValidateMinMaxInfo(), xxxIsDragging(), xxxMenuWindowProc(), xxxMetricsRecalc(), xxxPaintSwitchWindow(), and xxxPressButton().

00169 { 00170 VALIDATERECT(prc, FALSE); 00171 00172 prc->left -= cx; 00173 prc->right += cx; 00174 prc->top -= cy; 00175 prc->bottom += cy; 00176 return TRUE; 00177 }

BOOL APIENTRY IntersectRect LPRECT  prcDst,
CONST RECT *  prcSrc1,
CONST RECT *  prcSrc2
 

Definition at line 191 of file rect.c.

References APIENTRY, BOOL, FALSE, max, min, SetRectEmpty, TRUE, and VALIDATERECT.

Referenced by _MonitorFromRect(), AddNextContiguousRectangle(), CalcWindowVisRgn(), CreateSpb(), ECSetEditClip(), FBitsTouch(), FindBestPos(), FindOldMonitor(), FixBogusSWP(), GetWallpaperCenterRect(), InternalInvalidate2(), InternalScrollDC(), IntersectWithParents(), MLScroll(), MLSetCaretPosition(), MoveRect(), OffsetChildren(), ParkIcon(), PixieHack(), PreventInterMonitorBlts(), RemoveOverlaps(), SaveScreen(), SmartRectInRegion(), SpbCheckDce(), SubtractRect(), TryRect(), UT_GetParentDCClipBox(), xxxDrawDragRect(), xxxEnumDisplayMonitors(), xxxGetUpdateRect(), xxxInternalInvalidate(), xxxLBPaint(), xxxMNOpenHierarchy(), xxxMoveSize(), xxxRedrawHungWindow(), xxxScrollWindowEx(), xxxSnapWindow(), xxxSystemParametersInfo(), and zzzChangeStates().

00196 { 00197 VALIDATERECT(prcDst, FALSE); 00198 VALIDATERECT(prcSrc1, FALSE); 00199 VALIDATERECT(prcSrc2, FALSE); 00200 00201 prcDst->left = max(prcSrc1->left, prcSrc2->left); 00202 prcDst->right = min(prcSrc1->right, prcSrc2->right); 00203 00204 /* 00205 * check for empty rect 00206 */ 00207 if (prcDst->left < prcDst->right) { 00208 00209 prcDst->top = max(prcSrc1->top, prcSrc2->top); 00210 prcDst->bottom = min(prcSrc1->bottom, prcSrc2->bottom); 00211 00212 /* 00213 * check for empty rect 00214 */ 00215 if (prcDst->top < prcDst->bottom) { 00216 return TRUE; // not empty 00217 } 00218 } 00219 00220 /* 00221 * empty rect 00222 */ 00223 SetRectEmpty(prcDst); 00224 00225 return FALSE; 00226 }

BOOL APIENTRY IsRectEmpty CONST RECT *  prc  ) 
 

Definition at line 101 of file rect.c.

References APIENTRY, BOOL, TRUE, and VALIDATERECT.

Referenced by _MonitorFromRect(), DrawDiagonalLine(), InvertScrollHilite(), PreventInterMonitorBlts(), xxxDWP_Paint(), xxxMinimizeHungWindow(), xxxMinMaximize(), xxxSetWindowPos(), and zzzClipCursor().

00103 { 00104 VALIDATERECT(prc, TRUE); 00105 00106 return ((prc->left >= prc->right) || (prc->top >= prc->bottom)); 00107 }

BOOL APIENTRY OffsetRect LPRECT  prc,
int  cx,
int  cy
 

Definition at line 139 of file rect.c.

References APIENTRY, BOOL, cy, FALSE, TRUE, and VALIDATERECT.

Referenced by _GetClientRect(), _GetScrollBarInfo(), _GetWindowPlacement(), _ScrollDC(), _UserSoundSentryWorker(), AddNextContiguousRectangle(), AlignRects(), CalcClientScrolling(), CenterRectangles(), GetMonitorDC(), GetRect(), InternalCreateDialog(), MNPositionSysMenu(), MoveRect(), NormalizeRect(), OffsetChildren(), CProfilePropertySheet::OnInit(), RemoveOverlap(), RepositionRect(), ResetOrg(), SetEndTaskDlgStatus(), SpbCheckDce(), xxxCalcValidRects(), xxxEnumDisplayMonitors(), xxxGetMenuItemRect(), xxxGetUpdateRect(), xxxGetUpdateRgn(), xxxInternalPaintDesktop(), xxxMetricsRecalc(), xxxMNFindWindowFromPoint(), xxxMS_TrackMove(), xxxRedrawHungWindow(), xxxScrollWindowEx(), xxxSetInternalWindowPos(), and xxxSetWindowPlacement().

00143 { 00144 VALIDATERECT(prc, FALSE); 00145 00146 prc->left += cx; 00147 prc->right += cx; 00148 prc->bottom += cy; 00149 prc->top += cy; 00150 return TRUE; 00151 }

BOOL APIENTRY PtInRect CONST RECT *  prc,
POINT  pt
 

Definition at line 118 of file rect.c.

References APIENTRY, BOOL, FALSE, and VALIDATERECT.

Referenced by _ChildWindowFromPointEx(), _MonitorFromPoint(), _RealChildWindowFromPoint(), ButtonWndProcWorker(), ClipPointToDesktop(), ComboBoxWndProcWorker(), EditWndProc(), EnumPwndDlgChildProc(), FindNCHit(), ISelFromPt(), MNItemHitTest(), ReaderWndProc(), RemoveOverlap(), ScrollIfNecessary(), SpeedHitTest(), xxxEndScroll(), xxxHandleMenuMessages(), xxxHelpLoop(), xxxIsDragging(), xxxMenuWindowProc(), xxxMNFindWindowFromPoint(), xxxMS_TrackMove(), xxxQueryDropObject(), xxxScanSysQueue(), xxxSystemTimerProc(), xxxTrackBox(), xxxTrackCaptionButton(), xxxTrackInitSize(), xxxTrackMouse(), xxxTrackThumb(), xxxWindowHitTest2(), zzzActiveCursorTracking(), and zzzClipCursor().

00121 { 00122 VALIDATERECT(prc, FALSE); 00123 00124 return ((pt.x >= prc->left) && (pt.x < prc->right) && 00125 (pt.y >= prc->top) && (pt.y < prc->bottom)); 00126 }

void RECTFromSIZERECT PRECT  prc,
PCSIZERECT  psrc
 

Definition at line 448 of file rect.c.

References tagSIZERECT::cx, tagSIZERECT::cy, PCSIZERECT, tagSIZERECT::x, and tagSIZERECT::y.

Referenced by xxxCheckFullScreen(), and xxxCreateWindowEx().

00449 { 00450 prc->left = psrc->x; 00451 prc->top = psrc->y; 00452 prc->right = psrc->x + psrc->cx; 00453 prc->bottom = psrc->y + psrc->cy; 00454 }

BOOL APIENTRY SetRect LPRECT  prc,
int  left,
int  top,
int  right,
int  bottom
 

Definition at line 27 of file rect.c.

References APIENTRY, BOOL, FALSE, TRUE, and VALIDATERECT.

Referenced by FindBestPos(), ResetMouseHover(), UserLpkPSMTextOut(), xxxPSMTextOut(), and xxxScrollWindowEx().

00033 { 00034 VALIDATERECT(prc, FALSE); 00035 00036 prc->left = left; 00037 prc->top = top; 00038 prc->right = right; 00039 prc->bottom = bottom; 00040 return TRUE; 00041 }

BOOL APIENTRY SetRectEmpty LPRECT  prc  ) 
 

Definition at line 427 of file rect.c.

References APIENTRY, BOOL, FALSE, TRUE, and VALIDATERECT.

00429 { 00430 VALIDATERECT(prc, FALSE); 00431 00432 RtlZeroMemory(prc, sizeof(RECT)); 00433 return TRUE; 00434 }

void SIZERECTFromRECT PSIZERECT  psrc,
LPCRECT  prc
 

Definition at line 467 of file rect.c.

References tagSIZERECT::cx, tagSIZERECT::cy, PSIZERECT, tagSIZERECT::x, and tagSIZERECT::y.

00468 { 00469 psrc->x = prc->left; 00470 psrc->y = prc->top; 00471 psrc->cx = prc->right - prc->left; 00472 psrc->cy = prc->bottom - prc->top; 00473 }

BOOL APIENTRY SubtractRect LPRECT  prcDst,
CONST RECT *  prcSrc1,
CONST RECT *  prcSrc2
 

Definition at line 327 of file rect.c.

References APIENTRY, BOOL, FALSE, IntersectRect(), SetRectEmpty, TRUE, and VALIDATERECT.

Referenced by CreateSpb(), FBitsTouch(), InternalScrollDC(), and xxxInvalidateDesktopOnPaletteChange().

00331 { 00332 int cSidesOut; 00333 BOOL fIntersect; 00334 RECT rcInt; 00335 00336 VALIDATERECT(prcDst, FALSE); 00337 VALIDATERECT(prcSrc1, FALSE); 00338 VALIDATERECT(prcSrc2, FALSE); 00339 00340 fIntersect = IntersectRect(&rcInt, prcSrc1, prcSrc2); 00341 00342 /* 00343 * this is done after the intersection in case prcDst is the same 00344 * pointer as prcSrc2 00345 */ 00346 *prcDst = *prcSrc1; 00347 00348 if (fIntersect) { 00349 /* 00350 * exactly any 3 sides of prc2 must be outside prc1 to subtract 00351 */ 00352 cSidesOut = 0; 00353 if (rcInt.left <= prcSrc1->left) 00354 cSidesOut++; 00355 if (rcInt.top <= prcSrc1->top) 00356 cSidesOut++; 00357 if (rcInt.right >= prcSrc1->right) 00358 cSidesOut++; 00359 if (rcInt.bottom >= prcSrc1->bottom) 00360 cSidesOut++; 00361 00362 if (cSidesOut == 4) { 00363 /* 00364 * result is the empty rect 00365 */ 00366 SetRectEmpty(prcDst); 00367 return FALSE; 00368 } 00369 00370 if (cSidesOut == 3) { 00371 /* 00372 * subtract the intersecting rect 00373 */ 00374 if (rcInt.left > prcSrc1->left) 00375 prcDst->right = rcInt.left; 00376 00377 else if (rcInt.right < prcSrc1->right) 00378 prcDst->left = rcInt.right; 00379 00380 else if (rcInt.top > prcSrc1->top) 00381 prcDst->bottom = rcInt.top; 00382 00383 else if (rcInt.bottom < prcSrc1->bottom) 00384 prcDst->top = rcInt.bottom; 00385 } 00386 } 00387 00388 if ((prcDst->left >= prcDst->right) || (prcDst->top >= prcDst->bottom)) 00389 return FALSE; 00390 00391 return TRUE; 00392 }

BOOL APIENTRY UnionRect LPRECT  prcDst,
CONST RECT *  prcSrc1,
CONST RECT *  prcSrc2
 

Definition at line 241 of file rect.c.

References APIENTRY, BOOL, FALSE, max, min, SetRectEmpty, TRUE, and VALIDATERECT.

Referenced by _ScrollDC(), CalcClientScrolling(), CenterRectangles(), InternalScrollDC(), MLScroll(), SmoothScrollWindowEx(), and xxxScrollWindowEx().

00245 { 00246 BOOL frc1Empty, frc2Empty; 00247 00248 VALIDATERECT(prcDst, FALSE); 00249 VALIDATERECT(prcSrc1, FALSE); 00250 VALIDATERECT(prcSrc2, FALSE); 00251 00252 frc1Empty = ((prcSrc1->left >= prcSrc1->right) || 00253 (prcSrc1->top >= prcSrc1->bottom)); 00254 00255 frc2Empty = ((prcSrc2->left >= prcSrc2->right) || 00256 (prcSrc2->top >= prcSrc2->bottom)); 00257 00258 if (frc1Empty && frc2Empty) { 00259 SetRectEmpty(prcDst); 00260 return FALSE; 00261 } 00262 00263 if (frc1Empty) { 00264 *prcDst = *prcSrc2; 00265 return TRUE; 00266 } 00267 00268 if (frc2Empty) { 00269 *prcDst = *prcSrc1; 00270 return TRUE; 00271 } 00272 00273 /* 00274 * form the union of the two non-empty rects 00275 */ 00276 prcDst->left = min(prcSrc1->left, prcSrc2->left); 00277 prcDst->top = min(prcSrc1->top, prcSrc2->top); 00278 prcDst->right = max(prcSrc1->right, prcSrc2->right); 00279 prcDst->bottom = max(prcSrc1->bottom, prcSrc2->bottom); 00280 00281 return TRUE; 00282 }


Generated on Sat May 15 19:45:27 2004 for test by doxygen 1.3.7