/* clip_it.c Copyright (C) 1992 Markus M. Nick Schachelbare Clipping-Funktionen: clip_start(int x. int y, int w, int h) Neuen Clippingbereich einstellen (alten merken) Bei clip_end(void) Zum alten Clippingbereich zurck */ #include #include #include #include #include #include "stuff.h" #define CLIP_STK_DEPTH 20 static int clip_stk[CLIP_STK_DEPTH][4]; static clip_stk_idx = -1; void clip_start(x, y, w, h) int x, y, w, h; { int *p = clip_stk[++clip_stk_idx]; /* bei šberlauf unten rausschieben */ if (clip_stk_idx >= CLIP_STK_DEPTH) { memmove(/*&*/clip_stk[0], /*&*/clip_stk[1], sizeof(clip_stk[0]) * (CLIP_STK_DEPTH - 1)); clip_stk_idx = CLIP_STK_DEPTH - 1; } if (x || y || w || h) { /* xywh != 0 */ p[0] = x; p[1] = y; p[2] = x + w-1; p[3] = y + h-1; vs_clip(lib_handle, TRUE, p); } else { p[0] = p[1] = p[2] = p[3] = 0; vs_clip(lib_handle, FALSE, p); } } void clip_end() { int *p = clip_stk[--clip_stk_idx]; if (clip_stk_idx < 0) { clip_stk_idx = -1; vs_clip(lib_handle, FALSE, clip_stk[0]); } else { vs_clip(lib_handle, p[0] || p[1] || p[2] || p[3], p); } } /* -eof- */