diff options
author | Bernie Innocenti <bernie@codewiz.org> | 2010-05-03 21:53:47 (GMT) |
---|---|---|
committer | Bernie Innocenti <bernie@codewiz.org> | 2010-05-03 21:53:47 (GMT) |
commit | 1030dc837b10a03a02a85d5504cbeec168ce49e2 (patch) | |
tree | 698eefa87ac437deaf36a4141b326f8ce7986692 /src/engine/rotated.c |
Import XaoS r489 (trunk after version 3.5)
Diffstat (limited to 'src/engine/rotated.c')
-rw-r--r-- | src/engine/rotated.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/engine/rotated.c b/src/engine/rotated.c new file mode 100644 index 0000000..69e24fd --- /dev/null +++ b/src/engine/rotated.c @@ -0,0 +1,56 @@ +#ifndef UNSUPPORTED +static void do_rotate(void *data, struct taskinfo *task, int r1, int r2) +{ + struct filter *f = (struct filter *) data; + struct rotatedata *s = (struct rotatedata *) f->data; + double xstep = (s->x2 - s->x1) * 65536 / f->image->height; + double ystep = (s->y2 - s->y1) * 65536 / f->image->height; + double x = (s->x1) * 65536, y = (s->y1) * 65536; + + int ixstep = (int) ((s->xx1 - s->x1) * 65536); + int iystep = (int) ((s->yy1 - s->y1) * 65536); + int i; + + if (x < 0) + x = 0; /*avoid shifting problems */ + if (y < 0) + y = 0; + + ixstep /= f->image->width; + iystep /= f->image->width; + + /* I do floating point dda here since I expect that registers used by dda will + * not conflict with registers of integer one used by main loop so it will be + * faster than dda from stack :) + */ + x += r1 * xstep; + y += r1 * ystep; + for (i = r1; i < r2; i++) { + + { + register int ix = (int) x; + register int iy = (int) y; + register cpixel_t **vbuff = + (cpixel_t **) f->childimage->currlines; + register cpixel_t *end = + p_add((cpixel_t *) f->image->currlines[i], + f->image->width), *dest = + (cpixel_t *) f->image->currlines[i]; + register int iixstep = ixstep, iiystep = iystep; + + while (dest < end) { + p_copy(dest, 0, (cpixel_t *) (vbuff[iy >> 16]), + (ix >> 16)); + p_inc(dest, 1); + ix += iixstep; + iy += iiystep; + } + } + + x += xstep; + y += ystep; + + } +} +#endif +#undef do_rotate |