1 #ifndef UNSUPPORTED
do_edge(void * data,struct taskinfo *,int r1,int r2)2 static void do_edge(void *data, struct taskinfo */*task*/, int r1, int r2)
3 {
4 struct filter *f = (struct filter *)data;
5 int y;
6 unsigned int *pixels = f->image->palette->pixels;
7 unsigned int black = f->image->palette->pixels[0];
8 cpixel_t *output, *end;
9 spixel_t *up, *down, *input;
10
11 for (y = r1; y < r2; y++) {
12 output = p_add(((cpixel_t *)f->image->currlines[y]), 1);
13 input = ((spixel_t *)f->childimage->currlines[y]) + 1;
14
15 if (y != 0)
16 up = ((spixel_t *)f->childimage->currlines[y - 1]) + 1;
17 else
18 up = ((spixel_t *)f->childimage->currlines[y]) + 1;
19
20 if (y != f->image->height - 1)
21 down = ((spixel_t *)f->childimage->currlines[y + 1]) + 1;
22 else
23 down = ((spixel_t *)f->childimage->currlines[y]) + 1;
24
25 end = p_add(((cpixel_t *)f->image->currlines[y]), f->image->width - 1);
26 p_setp(output, -1, 0);
27 p_setp(output, f->image->width - 2, 0);
28
29 while (output < end) {
30 if (input[0] > up[0] || input[0] > down[0]) {
31 p_set(output, pixels[input[0]]);
32 } else if (input[0] != input[1]) {
33 if (input[0] < input[1]) {
34 p_set(output, black);
35 p_inc(output, 1);
36 input++;
37 up++;
38 down++;
39 }
40 p_set(output, pixels[input[0]]);
41 } else
42 p_set(output, black);
43 p_inc(output, 1);
44 input++;
45 up++;
46 down++;
47 }
48 }
49 }
50 #endif
51 #undef do_edge
52