ivi-shell multi screen support
[AGL/meta-agl-demo.git] / recipes-graphics / wayland / weston / 0006-ivi-shell-transforming-from-a-single-screen-coordina.patch
1 From 2a3b8a213d5076aa6f051e88858b65ebfc53f64a Mon Sep 17 00:00:00 2001
2 From: Nobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp>
3 Date: Mon, 30 Nov 2015 15:08:32 +0900
4 Subject: [PATCH] ivi-shell: transforming from a single screen coordinates to
5  multi screen coordinates: global coordinates.
6
7 In single screen, the coordinates of layer local coordinates are the
8 same as global coordinates. However, to support multi screens, the
9 layer-local coordinates shall be transformed to multi screen coordinates,
10 which is global coordinates. The abosolute coordinates of a screen in global
11 stored in (x,y) of output of its weston output so it shall be used to
12 transform layer-local to global coordinates.
13
14 Signed-off-by: Nobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp>
15 ---
16  ivi-shell/ivi-layout.c | 8 +++++++-
17  1 file changed, 7 insertions(+), 1 deletion(-)
18
19 diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
20 index 1773af8..65c2735 100644
21 --- a/ivi-shell/ivi-layout.c
22 +++ b/ivi-shell/ivi-layout.c
23 @@ -679,6 +679,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 @@ -686,6 +687,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 @@ -713,7 +715,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 @@ -723,6 +727,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 -- 
60 2.7.4
61