Use pixel coordinates for weston_output.matrix
Previously, weston_output.matrix was in GL coordinates and therefore only
really useful for the GL backend.
This breaks zoom, which will be fixed by the following patch:
zoom: Use pixels instead of GL coordinates
[Pekka: added a comment to compositor.h, message]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index 11f7ca6..10d7d71 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -76,6 +76,8 @@
enum gl_border_status border_damage[BUFFER_DAMAGE_COUNT];
struct gl_border_image borders[4];
enum gl_border_status border_status;
+
+ struct weston_matrix output_matrix;
};
enum buffer_type {
@@ -574,9 +576,10 @@
{
int i;
struct gl_surface_state *gs = get_surface_state(view->surface);
+ struct gl_output_state *go = get_output_state(output);
glUniformMatrix4fv(shader->proj_uniform,
- 1, GL_FALSE, output->matrix.d);
+ 1, GL_FALSE, go->output_matrix.d);
glUniform4fv(shader->color_uniform, 1, gs->color);
glUniform1f(shader->alpha_uniform, view->alpha);
@@ -954,6 +957,15 @@
output->current_mode->width,
output->current_mode->height);
+ /* Calculate the global GL matrix */
+ go->output_matrix = output->matrix;
+ weston_matrix_translate(&go->output_matrix,
+ -(output->current_mode->width / 2.0),
+ -(output->current_mode->height / 2.0), 0);
+ weston_matrix_scale(&go->output_matrix,
+ 2.0 / output->current_mode->width,
+ -2.0 / output->current_mode->height, 1);
+
/* if debugging, redraw everything outside the damage to clean up
* debug lines from the previous draw on this buffer:
*/