diff options
author | Dennis Kasprzyk <onestone@opencompositing.org> | 2008-01-24 02:20:56 +0100 |
---|---|---|
committer | Dennis Kasprzyk <onestone@opencompositing.org> | 2008-01-24 02:20:56 +0100 |
commit | 017d567150d93454a51c889f80056f3fdf1f460b (patch) | |
tree | 67ea2abae2ec5446ef75391fe8130c436bce846b | |
parent | f93c97cca95f9957e2e84cccc35a7eacf7b73aa9 (diff) | |
download | mag-017d567150d93454a51c889f80056f3fdf1f460b.tar.gz mag-017d567150d93454a51c889f80056f3fdf1f460b.tar.bz2 |
Make copied area 2 pixels bigger to avoid interpolation errors at the edges.
-rw-r--r-- | mag.c | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -794,28 +794,30 @@ magPaintFisheye (CompScreen *s) float radius, zoom, base; int x1, x2, y1, y2; float vc[4]; + int size; MAG_SCREEN (s); radius = magGetRadius (s); base = 0.5 + (0.0015 * radius); zoom = (ms->zoom * base) + 1.0 - base; - - x1 = MAX (0.0, ms->posX - radius); - x2 = MIN (s->width, ms->posX + radius); - y1 = MAX (0.0, ms->posY - radius); - y2 = MIN (s->height, ms->posY + radius); + size = radius + 1; + + x1 = MAX (0.0, ms->posX - size); + x2 = MIN (s->width, ms->posX + size); + y1 = MAX (0.0, ms->posY - size); + y2 = MIN (s->height, ms->posY + size); glEnable (ms->target); glBindTexture (ms->target, ms->texture); - if (ms->width != 2 * radius || ms->height != 2 * radius) + if (ms->width != 2 * size || ms->height != 2 * size) { glCopyTexImage2D(ms->target, 0, GL_RGB, x1, s->height - y2, - radius * 2, radius * 2, 0); - ms->width = ms->height = 2 * radius; + size * 2, size * 2, 0); + ms->width = ms->height = 2 * size; } else glCopyTexSubImage2D (ms->target, 0, 0, 0, @@ -854,6 +856,11 @@ magPaintFisheye (CompScreen *s) -x1 * pw, -(s->height - y2) * ph, 0.0, 0.0); + x1 = MAX (0.0, ms->posX - radius); + x2 = MIN (s->width, ms->posX + radius); + y1 = MAX (0.0, ms->posY - radius); + y2 = MIN (s->height, ms->posY + radius); + vc[0] = ((x1 * 2.0) / s->width) - 1.0; vc[1] = ((x2 * 2.0) / s->width) - 1.0; vc[2] = ((y1 * -2.0) / s->height) + 1.0; |