summaryrefslogtreecommitdiff
path: root/gst/geometrictransform
diff options
context:
space:
mode:
authorFilippo Argiolas <filippo.argiolas@gmail.com>2010-08-05 12:43:15 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-08-09 19:25:53 +0200
commit7be30c3daf72d7300143cb143a74d77185602256 (patch)
tree11e4c4c09645401a9df9032aa91df962ee347d04 /gst/geometrictransform
parent1652a3ef5710a18d77a3c28498f5d6f84c2aee05 (diff)
downloadgstreamer-plugins-bad-7be30c3daf72d7300143cb143a74d77185602256.tar.gz
geometrictransform: make tunnel "radius" customizable
https://bugzilla.gnome.org/show_bug.cgi?id=625908
Diffstat (limited to 'gst/geometrictransform')
-rw-r--r--gst/geometrictransform/gsttunnel.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gst/geometrictransform/gsttunnel.c b/gst/geometrictransform/gsttunnel.c
index 1246db453..861a911ca 100644
--- a/gst/geometrictransform/gsttunnel.c
+++ b/gst/geometrictransform/gsttunnel.c
@@ -96,14 +96,13 @@ tunnel_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x,
norm_x = 2.0 * (x - cgt->x_center * width) / MAX (width, height);
norm_y = 2.0 * (y - cgt->y_center * height) / MAX (width, height);
- r = sqrt (norm_x * norm_x + norm_y * norm_y);
+ /* calculate radius, normalize to 1 for future convenience */
+ r = sqrt (0.5 * (norm_x * norm_x + norm_y * norm_y));
- /* do nothing if r < 0.5 */
+ /* do nothing if r < radius */
/* zoom otherwise */
- /* the second edge is the tunnel radius, see gststretch.c for
- * comments about its customizability */
- norm_x *= CLAMP (r, 0.0, 0.5) / r;
- norm_y *= CLAMP (r, 0.0, 0.5) / r;
+ norm_x *= CLAMP (r, 0.0, cgt->radius) / r;
+ norm_y *= CLAMP (r, 0.0, cgt->radius) / r;
/* unnormalize */
*in_x = 0.5 * (norm_x) * MAX (width, height) + cgt->x_center * width;