rpi4-osdev/part12-wgt/wclip.c
2021-03-07 19:07:08 +00:00

14 lines
520 B
C

#include "wgt.h"
void wclip (short x, short y, short x2, short y2)
{
tx = x; /* Upper x limit */
ty = y; /* Upper y limit */
bx = x2; /* Lower x limit */
by = y2; /* Lower y limit */
/* Stay within screen bounds, no negatives */
if (tx < 0) tx = 0;
if (ty < 0) ty = 0;
if (bx >= WGT_SYS.xres) bx = WGT_SYS.xres - 1;
if (by >= WGT_SYS.yres) by = WGT_SYS.yres - 1;
}