diff options
author | Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com> | 2020-07-29 16:50:59 +0200 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2020-08-17 09:58:23 +0000 |
commit | 4a378afa3beac4f4341f5294927107f64123008a (patch) | |
tree | 3c97f17b63ac2fe01eb60bef6c0590b0da91a73f | |
parent | 3097acc702465e54fea64dfd0eedfe522e38a212 (diff) |
ivi-shell: Avoid unnecessary scaling of the view transformation matrix
The opaque region of a weston view is updated only if the alpha value is 1
and the transform matrix is of type WESTON_MATRIX_TRANSFORM_TRANSLATE.
While using ivi-shell, opaque region is never updated, as we are performing
scaling operations to the view transform matrix, even when the scaling
factor is 1 and thereby changing the type to WESTON_MATRIX_TRANSFORM_SCALE.
Perform scaling of the view transformation matrix only when the scaling
factor is non-zero.
Signed-off-by: Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>
-rw-r--r-- | ivi-shell/ivi-layout.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index 7cec79d7..b2f8323b 100644 --- a/ivi-shell/ivi-layout.c +++ b/ivi-shell/ivi-layout.c @@ -345,9 +345,13 @@ calc_transformation_matrix(struct ivi_rectangle *source_rect, source_center_y = source_rect->y + source_rect->height * 0.5f; weston_matrix_translate(m, -source_center_x, -source_center_y, 0.0f); - scale_x = (float) dest_rect->width / (float) source_rect->width; - scale_y = (float) dest_rect->height / (float) source_rect->height; - weston_matrix_scale(m, scale_x, scale_y, 1.0f); + if ((dest_rect->width != source_rect->width) || + (dest_rect->height != source_rect->height)) + { + scale_x = (float) dest_rect->width / (float) source_rect->width; + scale_y = (float) dest_rect->height / (float) source_rect->height; + weston_matrix_scale(m, scale_x, scale_y, 1.0f); + } translate_x = dest_rect->width * 0.5f + dest_rect->x; translate_y = dest_rect->height * 0.5f + dest_rect->y; |