1 From b995f26e62de2ba8965700062ccf98a8f65fffd0 Mon Sep 17 00:00:00 2001
2 From: Koji Ohira <kk.ohira.koji@nttd-mse.com>
3 Date: Thu, 24 Nov 2016 21:14:38 +0900
4 Subject: [PATCH] [RFR] ivi-shell: multi screen support to calcuration of a
5 mask of weston_surface.
7 A weston_surface is transformed to multi screen coordinate, global
8 coordinate by matrix:m now.
10 Additionally, a mask needs to be calucated, taking account into,
11 - multi screen coordination: a destination rectangle of layer in the
12 coordination is easily calcurated by adding weston_output.{x,y} in
13 simple. This is because there is no scaled and rotated transformation.
14 - intersect inside of a screen the layer is assigned to. This is because
15 overlapped region of weston surface in another screen shall not be
16 displayed according to ivi use case.
18 Signed-off-by: Koji Ohira <kk.ohira.koji@nttd-mse.com>
20 ivi-shell/ivi-layout.c | 38 ++++++++++++++++++++++++++++++++------
21 1 file changed, 32 insertions(+), 6 deletions(-)
23 diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
24 index 65c2735..008fbe5 100644
25 --- a/ivi-shell/ivi-layout.c
26 +++ b/ivi-shell/ivi-layout.c
27 @@ -665,15 +665,24 @@ calc_inverse_matrix_transform(const struct weston_matrix *matrix,
30 * This computes the whole transformation matrix:m from surface-local
31 - * coordinates to global coordinates. It is assumed that
32 - * weston_view::geometry.{x,y} are zero.
33 + * coordinates to multi screens coordinate, which is global coordinates.
34 + * It is assumed that weston_view::geometry.{x,y} are zero.
36 * Additionally, this computes the mask on surface-local coordinates as a
37 * ivi_rectangle. This can be set to weston_view_set_mask.
39 * The mask is computed by following steps
40 - * - destination rectangle of layer is inversed to surface-local cooodinates
41 - * by inversed matrix:m.
42 + * - destination rectangle of layer is tansformed to multi screen coordinate,
43 + * global coordinates. This is done by adding weston_output.{x,y} in simple
44 + * because there is no scaled and rotated transformation.
45 + * - destination rectangle of layer in multi screens coordinate needs to be
46 + * intersected inside of a screen the layer is assigned to. This is because
47 + * overlapped region of weston surface in another screen shall not be
48 + * displayed according to ivi use case.
49 + * - destination rectangle of layer
50 + * - in multi screen coordinates,
51 + * - and intersected inside of an assigned screen,
52 + * is inversed to surface-local cooodinates by inversed matrix:m.
53 * - the area is intersected by intersected area between weston_surface and
54 * source rectangle of ivi_surface.
56 @@ -708,7 +717,17 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface(
60 + struct ivi_rectangle screen_dest_rect = { output->x,
64 + struct ivi_rectangle layer_dest_rect_in_global =
65 + { lp->dest_x + output->x,
66 + lp->dest_y + output->y,
69 struct ivi_rectangle surface_result;
70 + struct ivi_rectangle layer_dest_rect_in_global_intersected;
73 * the whole transformation matrix:m from surface-local
74 @@ -735,9 +754,16 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface(
75 ivi_rectangle_intersect(&surface_source_rect, &weston_surface_rect,
79 + * destination rectangle of layer in multi screens coordinate
80 + * is intersected to avoid displaying outside of an assigned screen.
82 + ivi_rectangle_intersect(&layer_dest_rect_in_global, &screen_dest_rect,
83 + &layer_dest_rect_in_global_intersected);
85 /* calc masking area of weston_surface from m */
86 calc_inverse_matrix_transform(m,
88 + &layer_dest_rect_in_global_intersected,
92 @@ -778,7 +804,7 @@ update_prop(struct ivi_layout_screen *iviscrn,
93 weston_matrix_init(&ivisurf->transform.matrix);
95 calc_surface_to_global_matrix_and_mask_to_weston_surface(
96 - ivilayer, ivisurf, &ivisurf->transform.matrix, &r);
97 + iviscrn, ivilayer, ivisurf, &ivisurf->transform.matrix, &r);
99 if (tmpview != NULL) {
100 weston_view_set_mask(tmpview, r.x, r.y, r.width, r.height);