File:  [Research Unix] / researchv9 / jerq / src / lib / j / rectclip.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:59 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv9-SUN3_old, researchv9-SUN3, HEAD
researchv9-SUN3(old)

#include <jerq.h>
rectclip(rp, b)		/* first by reference, second by value */
	register Rectangle *rp;
	Rectangle b;
{
	register Rectangle *bp= &b;
	/*
	 * Expand rectXrect() in line for speed
	 */
#define c corner
#define o origin
	if((rp->o.x<bp->c.x && bp->o.x<rp->c.x &&
	    rp->o.y<bp->c.y && bp->o.y<rp->c.y)==0)
		return 0;
	/* They must overlap */
	if(rp->origin.x<bp->origin.x)
		rp->origin.x=bp->origin.x;
	if(rp->origin.y<bp->origin.y)
		rp->origin.y=bp->origin.y;
	if(rp->corner.x>bp->corner.x)
		rp->corner.x=bp->corner.x;
	if(rp->corner.y>bp->corner.y)
		rp->corner.y=bp->corner.y;
	return 1;
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.