rpi4-osdev/part12-wgt/wgt/wclip.c
2021-03-25 09:20:48 +00:00

14 lines
531 B
C

#include "../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;
}