[PATCH weston] rpi-renderer: use weston_output matrix instead of a private matrix
Derek Foreman
derekf at osg.samsung.com
Thu May 7 09:54:18 PDT 2015
We already do this math in compositor.c so let's not duplicate it here.
Additionally, the copy here has broken zoom, so this also fixes zooming.
Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
src/rpi-renderer.c | 68 +++---------------------------------------------------
1 file changed, 3 insertions(+), 65 deletions(-)
diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c
index b6cf125..acc2cf5 100644
--- a/src/rpi-renderer.c
+++ b/src/rpi-renderer.c
@@ -149,7 +149,6 @@ struct rpir_output {
DISPMANX_DISPLAY_HANDLE_T display;
DISPMANX_UPDATE_HANDLE_T update;
- struct weston_matrix matrix;
/* all Elements currently on screen */
struct wl_list view_list; /* struct rpir_surface::link */
@@ -674,7 +673,6 @@ rpir_view_compute_rects(struct rpir_view *view,
VC_IMAGE_TRANSFORM_T *flipmask)
{
struct weston_output *output_base = view->view->surface->output;
- struct rpir_output *output = to_rpir_output(output_base);
struct weston_matrix matrix = view->view->transform.matrix;
VC_IMAGE_TRANSFORM_T flipt = 0;
int src_x, src_y;
@@ -708,14 +706,14 @@ rpir_view_compute_rects(struct rpir_view *view,
src_height = view->surface->front->height << 16;
}
- weston_matrix_multiply(&matrix, &output->matrix);
+ weston_matrix_multiply(&matrix, &output_base->matrix);
#ifdef SURFACE_TRANSFORM
if (matrix.type >= WESTON_MATRIX_TRANSFORM_OTHER) {
#else
if (matrix.type >= WESTON_MATRIX_TRANSFORM_ROTATE) {
#endif
- warn_bad_matrix(&matrix, &output->matrix,
+ warn_bad_matrix(&matrix, &output_base->matrix,
&view->view->transform.matrix);
} else {
if (matrix.type & WESTON_MATRIX_TRANSFORM_ROTATE) {
@@ -726,7 +724,7 @@ rpir_view_compute_rects(struct rpir_view *view,
fabsf(matrix.d[4]) < 1e-4) {
/* no transpose */
} else {
- warn_bad_matrix(&matrix, &output->matrix,
+ warn_bad_matrix(&matrix, &output_base->matrix,
&view->view->transform.matrix);
}
}
@@ -1320,64 +1318,6 @@ rpir_output_dmx_remove_all(struct rpir_output *output,
}
}
-static void
-output_compute_matrix(struct weston_output *base)
-{
- struct rpir_output *output = to_rpir_output(base);
- struct weston_matrix *matrix = &output->matrix;
-#ifdef SURFACE_TRANSFORM
- const float half_w = 0.5f * base->width;
- const float half_h = 0.5f * base->height;
-#endif
- float mag;
-
- weston_matrix_init(matrix);
- weston_matrix_translate(matrix, -base->x, -base->y, 0.0f);
-
-#ifdef SURFACE_TRANSFORM
- weston_matrix_translate(matrix, -half_w, -half_h, 0.0f);
- switch (base->transform) {
- case WL_OUTPUT_TRANSFORM_FLIPPED:
- weston_matrix_scale(matrix, -1.0f, 1.0f, 1.0f);
- case WL_OUTPUT_TRANSFORM_NORMAL:
- /* weston_matrix_rotate_xy(matrix, 1.0f, 0.0f); no-op */
- weston_matrix_translate(matrix, half_w, half_h, 0.0f);
- break;
-
- case WL_OUTPUT_TRANSFORM_FLIPPED_90:
- weston_matrix_scale(matrix, -1.0f, 1.0f, 1.0f);
- case WL_OUTPUT_TRANSFORM_90:
- weston_matrix_rotate_xy(matrix, 0.0f, 1.0f);
- weston_matrix_translate(matrix, half_h, half_w, 0.0f);
- break;
-
- case WL_OUTPUT_TRANSFORM_FLIPPED_180:
- weston_matrix_scale(matrix, -1.0f, 1.0f, 1.0f);
- case WL_OUTPUT_TRANSFORM_180:
- weston_matrix_rotate_xy(matrix, -1.0f, 0.0f);
- weston_matrix_translate(matrix, half_w, half_h, 0.0f);
- break;
-
- case WL_OUTPUT_TRANSFORM_FLIPPED_270:
- weston_matrix_scale(matrix, -1.0f, 1.0f, 1.0f);
- case WL_OUTPUT_TRANSFORM_270:
- weston_matrix_rotate_xy(matrix, 0.0f, -1.0f);
- weston_matrix_translate(matrix, half_h, half_w, 0.0f);
- break;
-
- default:
- break;
- }
-#endif
-
- if (base->zoom.active) {
- mag = 1.0f / (1.0f - base->zoom.spring_z.current);
- weston_matrix_translate(matrix, base->zoom.trans_x,
- base->zoom.trans_y, 0.0f);
- weston_matrix_scale(matrix, mag, mag, 1.0f);
- }
-}
-
/* Note: this won't work right for multiple outputs. A DispmanX Element
* is tied to one DispmanX Display, i.e. output.
*/
@@ -1394,8 +1334,6 @@ rpi_renderer_repaint_output(struct weston_output *base,
assert(output->update != DISPMANX_NO_HANDLE);
- output_compute_matrix(base);
-
rpi_resource_release(&output->capture_buffer);
free(output->capture_data);
output->capture_data = NULL;
--
2.1.4
More information about the wayland-devel
mailing list