From 0245ac210662c2f5cfec68bd0a463c0b252c121b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 31 Mar 2019 06:16:16 +0200 Subject: [PATCH] gl renderer: Apply transform only for final texture drawing We don't want the new transform while drawing things on a texture. Instead, only apply the new transform matrix when adding the final texture drawing ops. This fixes the stack cube rotation transition to at least look somewhat better. --- gsk/gl/gskglrenderer.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index 44c43d0d4f..3690924597 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -848,23 +848,23 @@ render_transform_node (GskGLRenderer *self, case GSK_TRANSFORM_CATEGORY_2D: default: { - const float min_x = child->bounds.origin.x; - const float min_y = child->bounds.origin.y; - const float max_x = min_x + child->bounds.size.width; - const float max_y = min_y + child->bounds.size.height; - int texture_id; - gboolean is_offscreen; graphene_matrix_t mat; - gsk_transform_to_matrix (node_transform, &mat); - ops_push_modelview (builder, &mat, category); - if (node_supports_transform (child)) { + gsk_transform_to_matrix (node_transform, &mat); + ops_push_modelview (builder, &mat, category); gsk_gl_renderer_add_render_ops (self, child, builder); + ops_pop_modelview (builder); } else { + const float min_x = child->bounds.origin.x; + const float min_y = child->bounds.origin.y; + const float max_x = min_x + child->bounds.size.width; + const float max_y = min_y + child->bounds.size.height; + int texture_id; + gboolean is_offscreen; /* For non-trivial transforms, we draw everything on a texture and then * draw the texture transformed. */ /* TODO: We should compute a modelview containing only the "non-trivial" @@ -876,6 +876,9 @@ render_transform_node (GskGLRenderer *self, child, &texture_id, &is_offscreen, RESET_CLIP | RESET_OPACITY); + + gsk_transform_to_matrix (node_transform, &mat); + ops_push_modelview (builder, &mat, category); ops_set_texture (builder, texture_id); ops_set_program (builder, &self->blit_program); @@ -907,9 +910,9 @@ render_transform_node (GskGLRenderer *self, ops_draw (builder, onscreen_vertex_data); } - } - ops_pop_modelview (builder); + ops_pop_modelview (builder); + } } } }