mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 23:58:17 +00:00
geometrictransform: make tunnel "radius" customizable
https://bugzilla.gnome.org/show_bug.cgi?id=625908
This commit is contained in:
parent
1652a3ef57
commit
7be30c3daf
1 changed files with 5 additions and 6 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue