mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
[qwaq] Add function to merge extents
It's pretty much the union of two rectangles with the same origin.
This commit is contained in:
parent
03f87d6f27
commit
6a18b1dd55
2 changed files with 7 additions and 0 deletions
|
@ -20,6 +20,7 @@ typedef struct Rect_s {
|
|||
@extern Rect makeRect (int xpos, int ypos, int xlen, int ylen);
|
||||
@extern Point makePoint (int x, int y);
|
||||
@extern Extent makeExtent (int width, int height);
|
||||
@extern Extent mergeExtents (Extent a, Extent b);
|
||||
//XXX will not work if point or rect point to a local variabl
|
||||
@extern int rectContainsPoint (Rect *rect, Point *point);
|
||||
@extern Rect clipRect (Rect clipRect, Rect rect);
|
||||
|
|
|
@ -39,6 +39,12 @@ Extent makeExtent (int width, int height)
|
|||
return {width, height};
|
||||
}
|
||||
|
||||
Extent mergeExtents (Extent a, Extent b)
|
||||
{
|
||||
return { a.width < b.width ? b.width : a.width,
|
||||
a.height < b.height ? b.height : a.height };
|
||||
}
|
||||
|
||||
int
|
||||
rectContainsPoint (Rect *rect, Point *point)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue