zoom: Remove unneeded usage of wl_fixed_ts in favour of doubles

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
dev
Giulio Camuffo 9 years ago committed by Derek Foreman
parent 4845354cfa
commit 6850e7b9e1
  1. 8
      src/compositor.h
  2. 22
      src/zoom.c

@ -144,20 +144,18 @@ struct weston_spring {
uint32_t clip;
};
struct weston_fixed_point {
wl_fixed_t x, y;
};
struct weston_output_zoom {
bool active;
float increment;
float level;
float max_level;
float trans_x, trans_y;
struct {
double x, y;
} current;
struct weston_seat *seat;
struct weston_animation animation_z;
struct weston_spring spring_z;
struct weston_fixed_point current;
struct wl_listener motion_listener;
};

@ -65,13 +65,13 @@ weston_zoom_frame_z(struct weston_animation *animation,
static void
zoom_area_center_from_point(struct weston_output *output,
wl_fixed_t *x, wl_fixed_t *y)
double *x, double *y)
{
float level = output->zoom.spring_z.current;
wl_fixed_t offset_x = wl_fixed_from_int(output->x);
wl_fixed_t offset_y = wl_fixed_from_int(output->y);
wl_fixed_t w = wl_fixed_from_int(output->width);
wl_fixed_t h = wl_fixed_from_int(output->height);
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;
@ -81,8 +81,8 @@ static void
weston_output_update_zoom_transform(struct weston_output *output)
{
float global_x, global_y;
wl_fixed_t x = output->zoom.current.x; /* global pointer coords */
wl_fixed_t y = output->zoom.current.y;
double x = output->zoom.current.x; /* global pointer coords */
double y = output->zoom.current.y;
float level;
level = output->zoom.spring_z.current;
@ -93,8 +93,8 @@ weston_output_update_zoom_transform(struct weston_output *output)
zoom_area_center_from_point(output, &x, &y);
global_x = wl_fixed_to_double(x);
global_y = wl_fixed_to_double(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;
@ -133,8 +133,8 @@ weston_output_update_zoom(struct weston_output *output)
assert(output->zoom.active);
output->zoom.current.x = pointer->x;
output->zoom.current.y = pointer->y;
output->zoom.current.x = wl_fixed_to_double(pointer->x);
output->zoom.current.y = wl_fixed_to_double(pointer->y);
weston_zoom_transition(output);
weston_output_update_zoom_transform(output);

Loading…
Cancel
Save