[PATCH weston v2] Convert wl_fixed_t to int in weston_output_update_zoom().

Scott Moreau oreaus at gmail.com
Wed May 16 07:29:24 PDT 2012


This way, we don't have to use wl_fixed_to_int() for each
call to weston_output_update_zoom(). It accepts wl_fixed_t
types and converts internally.
---

I see what you're saying now, thanks Ander. Changed 
weston_output_update_zoom() to accept wl_fixed_t types
so it's clear how it's meant to be used.

 src/compositor.c |    5 ++++-
 src/shell.c      |    4 +---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 788b1de..f272e4e 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2356,13 +2356,16 @@ weston_output_destroy(struct weston_output *output)
 }
 
 WL_EXPORT void
-weston_output_update_zoom(struct weston_output *output, int x, int y)
+weston_output_update_zoom(struct weston_output *output, wl_fixed_t x, wl_fixed_t y)
 {
 	float ratio;
 
 	if (output->zoom.level <= 0)
 		return;
 
+	x = wl_fixed_to_int(x);
+	y = wl_fixed_to_int(y);
+
 	output->zoom.magnification = 1 / output->zoom.level;
 	ratio = 1 - (1 / output->zoom.magnification);
 
diff --git a/src/shell.c b/src/shell.c
index fc49d70..95d08c6 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1642,9 +1642,7 @@ zoom_binding(struct wl_input_device *device, uint32_t time,
 			if (output->zoom.level < output->zoom.increment)
 				output->zoom.level = output->zoom.increment;
 
-			weston_output_update_zoom(output,
-			                          wl_fixed_to_int(device->x),
-						  wl_fixed_to_int(device->y));
+			weston_output_update_zoom(output, device->x, device->y);
 		}
 	}
 }
-- 
1.7.7.6



More information about the wayland-devel mailing list