[gtk] gl renderer: Pass correct matrix category when rendering offscreen
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] gl renderer: Pass correct matrix category when rendering offscreen
- Date: Mon, 20 May 2019 10:52:06 +0000 (UTC)
commit aa922f0779d7bc6d988383b39bd4c4c3157ad4d5
Author: Timm Bäder <mail baedert org>
Date: Mon May 20 12:10:12 2019 +0200
gl renderer: Pass correct matrix category when rendering offscreen
We can't just pretend we have an identity matrix when we are actually
scaling. This fixes the node editor sometimes not drawing things when
rendering to a texture. We were mistakenly discaring render nodes
because the bounds transformation was wrong.
gsk/gl/gskglrenderer.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 95310adfed..1a9f20bf02 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -2707,7 +2707,7 @@ add_offscreen_ops (GskGLRenderer *self,
int render_target;
int prev_render_target;
RenderOp op;
- graphene_matrix_t identity;
+ graphene_matrix_t modelview;
graphene_matrix_t prev_projection;
graphene_rect_t prev_viewport;
graphene_matrix_t item_proj;
@@ -2762,15 +2762,16 @@ add_offscreen_ops (GskGLRenderer *self,
(bounds->origin.y + bounds->size.height) * scale,
ORTHO_NEAR_PLANE, ORTHO_FAR_PLANE);
graphene_matrix_scale (&item_proj, 1, -1, 1);
- graphene_matrix_init_identity (&identity);
- graphene_matrix_scale (&identity, scale, scale, 1);
+ graphene_matrix_init_scale (&modelview, scale, scale, 1);
prev_render_target = ops_set_render_target (builder, render_target);
/* Clear since we use this rendertarget for the first time */
op.op = OP_CLEAR;
ops_add (builder, &op);
prev_projection = ops_set_projection (builder, &item_proj);
- ops_set_modelview (builder, &identity, GSK_TRANSFORM_CATEGORY_IDENTITY);
+ ops_set_modelview (builder, &modelview,
+ G_APPROX_VALUE (scale, 1.0, 0.01f) ? GSK_TRANSFORM_CATEGORY_IDENTITY :
+ GSK_TRANSFORM_CATEGORY_2D_AFFINE);
prev_viewport = ops_set_viewport (builder,
&GRAPHENE_RECT_INIT (bounds->origin.x * scale,
bounds->origin.y * scale,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]