From 7be30c3daf72d7300143cb143a74d77185602256 Mon Sep 17 00:00:00 2001 From: Filippo Argiolas Date: Thu, 5 Aug 2010 12:43:15 +0200 Subject: [PATCH] geometrictransform: make tunnel "radius" customizable https://bugzilla.gnome.org/show_bug.cgi?id=625908 --- gst/geometrictransform/gsttunnel.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gst/geometrictransform/gsttunnel.c b/gst/geometrictransform/gsttunnel.c index 1246db4539..861a911ca9 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;