rectclip.c

来自「在x86平台上运行不可信任代码的sandbox。」· C语言 代码 · 共 26 行

C
26
字号
#include "u.h"#include "lib.h"#include "draw.h"intrectclip(Rectangle *rp, Rectangle b)		/* first by reference, second by value */{	Rectangle *bp = &b;	/*	 * Expand rectXrect() in line for speed	 */	if((rp->min.x<bp->max.x && bp->min.x<rp->max.x &&	    rp->min.y<bp->max.y && bp->min.y<rp->max.y)==0)		return 0;	/* They must overlap */	if(rp->min.x < bp->min.x)		rp->min.x = bp->min.x;	if(rp->min.y < bp->min.y)		rp->min.y = bp->min.y;	if(rp->max.x > bp->max.x)		rp->max.x = bp->max.x;	if(rp->max.y > bp->max.y)		rp->max.y = bp->max.y;	return 1;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?