blob: ef1a9137230d5eec3cc29911133df97322cd0c9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include <allegro.h>
#include "subclip.h"
void subclip(int l, int t, int r, int b, void (*proc)(void *data), void *data)
{
int cl = screen->cl;
int ct = screen->ct;
int cr = screen->cr;
int cb = screen->cb;
if (l < cl) l = cl;
if (t < ct) t = ct;
if (r > cr) r = cr;
if (b > cb) b = cb;
if (r > l && b > t) {
screen->cl = l;
screen->ct = t;
screen->cr = r;
screen->cb = b;
(*proc)(data);
screen->cl = cl;
screen->ct = ct;
screen->cr = cr;
screen->cb = cb;
}
}
|