Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/planix-v0/sys/src/libdraw/rectclip.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <draw.h>
4
 
5
int
6
rectclip(Rectangle *rp, Rectangle b)		/* first by reference, second by value */
7
{
8
	Rectangle *bp = &b;
9
	/*
10
	 * Expand rectXrect() in line for speed
11
	 */
12
	if((rp->min.x<bp->max.x && bp->min.x<rp->max.x &&
13
	    rp->min.y<bp->max.y && bp->min.y<rp->max.y)==0)
14
		return 0;
15
	/* They must overlap */
16
	if(rp->min.x < bp->min.x)
17
		rp->min.x = bp->min.x;
18
	if(rp->min.y < bp->min.y)
19
		rp->min.y = bp->min.y;
20
	if(rp->max.x > bp->max.x)
21
		rp->max.x = bp->max.x;
22
	if(rp->max.y > bp->max.y)
23
		rp->max.y = bp->max.y;
24
	return 1;
25
}