Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/engine/edge2d.c
diff options
context:
space:
mode:
authorBernie Innocenti <bernie@codewiz.org>2010-05-03 21:53:47 (GMT)
committer Bernie Innocenti <bernie@codewiz.org>2010-05-03 21:53:47 (GMT)
commit1030dc837b10a03a02a85d5504cbeec168ce49e2 (patch)
tree698eefa87ac437deaf36a4141b326f8ce7986692 /src/engine/edge2d.c
Import XaoS r489 (trunk after version 3.5)
Diffstat (limited to 'src/engine/edge2d.c')
-rw-r--r--src/engine/edge2d.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/engine/edge2d.c b/src/engine/edge2d.c
new file mode 100644
index 0000000..4402b42
--- /dev/null
+++ b/src/engine/edge2d.c
@@ -0,0 +1,53 @@
+#ifndef UNSUPPORTED
+static void do_edge(void *data, struct taskinfo *task, int r1, int r2)
+{
+ struct filter *f = (struct filter *) data;
+ int y;
+ unsigned int *pixels = f->image->palette->pixels;
+ register unsigned int black = f->image->palette->pixels[0];
+ register cpixel_t *output, *end;
+ register spixel_t *up, *down, *input;
+
+ for (y = r1; y < r2; y++) {
+ output = p_add(((cpixel_t *) f->image->currlines[y]), 1);
+ input = ((spixel_t *) f->childimage->currlines[y]) + 1;
+
+ if (y != 0)
+ up = ((spixel_t *) f->childimage->currlines[y - 1]) + 1;
+ else
+ up = ((spixel_t *) f->childimage->currlines[y]) + 1;
+
+ if (y != f->image->height - 1)
+ down = ((spixel_t *) f->childimage->currlines[y + 1]) + 1;
+ else
+ down = ((spixel_t *) f->childimage->currlines[y]) + 1;
+
+ end =
+ p_add(((cpixel_t *) f->image->currlines[y]),
+ f->image->width - 1);
+ p_setp(output, -1, 0);
+ p_setp(output, f->image->width - 2, 0);
+
+ while (output < end) {
+ if (input[0] > up[0] || input[0] > down[0]) {
+ p_set(output, pixels[input[0]]);
+ } else if (input[0] != input[1]) {
+ if (input[0] < input[1]) {
+ p_set(output, black);
+ p_inc(output, 1);
+ input++;
+ up++;
+ down++;
+ }
+ p_set(output, pixels[input[0]]);
+ } else
+ p_set(output, black);
+ p_inc(output, 1);
+ input++;
+ up++;
+ down++;
+ }
+ }
+}
+#endif
+#undef do_edge