dra7xx-evm: weston: add changes for AGL home screen
[AGL/meta-agl.git] / meta-agl-bsp / meta-ti / recipes-arago / weston / weston / 0005-ivi-shell-convert-from-screen-to-global-coordinates.patch
1 From 26c4fc86516626e2e463171e4016ccd851125342 Mon Sep 17 00:00:00 2001
2 From: Nobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp>
3 Date: Wed, 9 Dec 2015 15:38:41 +0900
4 Subject: [PATCH 5/7] ivi-shell: convert from screen to global coordinates
5
6 In single screen, the coordinates of layer local coordinates are the
7 same as global coordinates. However, to support multi screens, the
8 layer-local coordinates shall be transformed to multi screen coordinates,
9 which is global coordinates. The abosolute coordinates of a screen in global
10 stored in (x,y) of output of its weston output so it shall be used to
11 transform layer-local to global coordinates.
12
13 Signed-off-by: Nobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp>
14 Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
15 ---
16  ivi-shell/ivi-layout.c | 10 ++++++++--
17  1 file changed, 8 insertions(+), 2 deletions(-)
18
19 diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
20 index a7c5e22..c7506de 100644
21 --- a/ivi-shell/ivi-layout.c
22 +++ b/ivi-shell/ivi-layout.c
23 @@ -688,6 +688,7 @@ calc_inverse_matrix_transform(const struct weston_matrix *matrix,
24   */
25  static void
26  calc_surface_to_global_matrix_and_mask_to_weston_surface(
27 +       struct ivi_layout_screen  *iviscrn,
28         struct ivi_layout_layer *ivilayer,
29         struct ivi_layout_surface *ivisurf,
30         struct weston_matrix *m,
31 @@ -695,6 +696,7 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface(
32  {
33         const struct ivi_layout_surface_properties *sp = &ivisurf->prop;
34         const struct ivi_layout_layer_properties *lp = &ivilayer->prop;
35 +       struct weston_output *output = iviscrn->output;
36         struct ivi_rectangle weston_surface_rect = { 0,
37                                                      0,
38                                                      ivisurf->surface->width,
39 @@ -732,7 +734,9 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface(
40          * coordinates to global coordinates, which is computed by
41          * two steps,
42          * - surface-local coordinates to layer-local coordinates
43 -        * - layer-local coordinates to global coordinates
44 +        * - layer-local coordinates to a single screen-local coordinates
45 +        * - a single screen-local coordinates to multi screen coordinates,
46 +         *   which is global coordinates.
47          */
48         calc_transformation_matrix(&surface_source_rect,
49                                    &surface_dest_rect,
50 @@ -742,6 +746,8 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface(
51                                    &layer_dest_rect,
52                                    lp->orientation, m);
53  
54 +       weston_matrix_translate(m, output->x, output->y, 0.0f);
55 +
56         /* this intersected ivi_rectangle would be used for masking
57          * weston_surface
58          */
59 @@ -798,7 +804,7 @@ update_prop(struct ivi_layout_screen  *iviscrn,
60                 weston_matrix_init(&ivisurf->transform.matrix);
61  
62                 calc_surface_to_global_matrix_and_mask_to_weston_surface(
63 -                       ivilayer, ivisurf, &ivisurf->transform.matrix, &r);
64 +                       iviscrn, ivilayer, ivisurf, &ivisurf->transform.matrix, &r);
65  
66                 if (tmpview != NULL) {
67                         weston_view_set_mask(tmpview, r.x, r.y, r.width, r.height);
68 -- 
69 2.4.5
70