summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2014-05-06 19:04:15 +0100
committerKristian Høgsberg <krh@bitplanet.net>2014-05-06 15:36:55 -0700
commit6c3b01f81e8e442b8c82efc702797aae629b33d2 (patch)
tree795872d3cd6b1d1acb8e3512e6da9e77a8be5e5e
parent2ef1cd177e73173d8cd25325ce691a09187134cb (diff)
downloadweston-6c3b01f81e8e442b8c82efc702797aae629b33d2.tar.gz
weston-6c3b01f81e8e442b8c82efc702797aae629b33d2.tar.bz2
weston-6c3b01f81e8e442b8c82efc702797aae629b33d2.zip
Apply the zoom transformation before the output transformation
The zoom translation is just a scale and a translate. The translation is calculated based on the coordinates of the pointer which are in global space. Previously the calculated translation was transformed by the output transformation so that when the zoom transform is applied after the output transform then it will be correct. However if we just apply the zoom transformation first then we get the same result without the zoom code having to be aware of the output transformation. This also fixes weston_output_transform_coordinate which was applying the output and zoom transforms in the wrong order. https://bugs.freedesktop.org/show_bug.cgi?id=78211
-rw-r--r--src/compositor.c4
-rw-r--r--src/zoom.c47
2 files changed, 2 insertions, 49 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 3d65e4cd..cd1ca9a4 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3198,8 +3198,6 @@ weston_output_update_matrix(struct weston_output *output)
2.0 / output->width,
-2.0 / output->height, 1);
- weston_output_compute_transform(output);
-
if (output->zoom.active) {
magnification = 1 / (1 - output->zoom.spring_z.current);
weston_output_update_zoom(output);
@@ -3209,6 +3207,8 @@ weston_output_update_matrix(struct weston_output *output)
magnification, 1.0);
}
+ weston_output_compute_transform(output);
+
output->dirty = 0;
}
diff --git a/src/zoom.c b/src/zoom.c
index 622c0d7c..7553849d 100644
--- a/src/zoom.c
+++ b/src/zoom.c
@@ -111,50 +111,6 @@ zoom_area_center_from_pointer(struct weston_output *output,
}
static void
-weston_zoom_apply_output_transform(struct weston_output *output,
- float *x, float *y)
-{
- float tx, ty;
-
- switch(output->transform) {
- case WL_OUTPUT_TRANSFORM_NORMAL:
- default:
- return;
- case WL_OUTPUT_TRANSFORM_90:
- tx = -*y;
- ty = *x;
- break;
- case WL_OUTPUT_TRANSFORM_180:
- tx = -*x;
- ty = -*y;
- break;
- case WL_OUTPUT_TRANSFORM_270:
- tx = *y;
- ty = -*x;
- break;
- case WL_OUTPUT_TRANSFORM_FLIPPED:
- tx = -*x;
- ty = *y;
- break;
- case WL_OUTPUT_TRANSFORM_FLIPPED_90:
- tx = -*y;
- ty = -*x;
- break;
- case WL_OUTPUT_TRANSFORM_FLIPPED_180:
- tx = *x;
- ty = -*y;
- break;
- case WL_OUTPUT_TRANSFORM_FLIPPED_270:
- tx = *y;
- ty = *x;
- break;
- }
-
- *x = tx;
- *y = ty;
-}
-
-static void
weston_output_update_zoom_transform(struct weston_output *output)
{
float global_x, global_y;
@@ -183,9 +139,6 @@ weston_output_update_zoom_transform(struct weston_output *output)
((((global_y - output->y) / output->height) *
(level * 2)) - level) * ratio;
- weston_zoom_apply_output_transform(output, &output->zoom.trans_x,
- &output->zoom.trans_y);
-
trans_max = level * 2 - level;
trans_min = -trans_max;