[PATCH] zoom: remove temporary variables

Bryce Harrington bryce at osg.samsung.com
Thu Oct 8 22:57:49 PDT 2015


On Thu, Oct 08, 2015 at 07:13:01PM +0300, Giulio Camuffo wrote:
> ---
> 
> This is a follow up to "zoom: Remove unneeded usage of wl_fixed_ts in favour of doubles"
> 
>  src/zoom.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)

Thanks, LGTM

Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
 
> diff --git a/src/zoom.c b/src/zoom.c
> index edffa89..08c0693 100644
> --- a/src/zoom.c
> +++ b/src/zoom.c
> @@ -68,19 +68,14 @@ zoom_area_center_from_point(struct weston_output *output,
>  			    double *x, double *y)
>  {
>  	float level = output->zoom.spring_z.current;
> -	double offset_x = output->x;
> -	double offset_y = output->y;
> -	double w = output->width;
> -	double h = output->height;
>  
> -	*x = (*x - offset_x) * level + w / 2;
> -	*y = (*y - offset_y) * level + h / 2;
> +	*x = (*x - output->x) * level + output->width / 2.;
> +	*y = (*y - output->y) * level + output->height / 2.;
>  }
>  
>  static void
>  weston_output_update_zoom_transform(struct weston_output *output)
>  {
> -	float global_x, global_y;
>  	double x = output->zoom.current.x; /* global pointer coords */
>  	double y = output->zoom.current.y;
>  	float level;
> @@ -93,11 +88,8 @@ weston_output_update_zoom_transform(struct weston_output *output)
>  
>  	zoom_area_center_from_point(output, &x, &y);
>  
> -	global_x = x;
> -	global_y = y;
> -
> -	output->zoom.trans_x = global_x - output->width / 2;
> -	output->zoom.trans_y = global_y - output->height / 2;
> +	output->zoom.trans_x = x - output->width / 2;
> +	output->zoom.trans_y = y - output->height / 2;
>  
>  	if (output->zoom.trans_x < 0)
>  		output->zoom.trans_x = 0;
> -- 
> 2.6.1
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list