[gtk+] gl renderer: Make width/height relation more obvious



commit 1fb5d389db33981be0cad53efd3c2c94698ff675
Author: Timm Bäder <mail baedert org>
Date:   Sat Jan 27 11:00:59 2018 +0100

    gl renderer: Make width/height relation more obvious
    
    In add_offscreen_ops, we use the max_x/min_x values for the texture and
    viewport width, and the max_y/min_y for the texture and viewport height.

 gsk/gl/gskglrenderer.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index bddcf45..dc97ebf 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -2219,6 +2219,8 @@ add_offscreen_ops (GskGLRenderer   *self,
                    gboolean        *is_offscreen,
                    gboolean         force_offscreen)
 {
+  const float width = max_x - min_x;
+  const float height = max_y - min_y;
   int render_target;
   int prev_render_target;
   RenderOp op;
@@ -2245,7 +2247,7 @@ add_offscreen_ops (GskGLRenderer   *self,
       return;
     }
 
-  *texture_id = gsk_gl_driver_create_texture (self->gl_driver, max_x - min_x, max_y - min_y);
+  *texture_id = gsk_gl_driver_create_texture (self->gl_driver, width, height);
   gsk_gl_driver_bind_source_texture (self->gl_driver, *texture_id);
   gsk_gl_driver_init_texture_empty (self->gl_driver, *texture_id);
   render_target = gsk_gl_driver_create_render_target (self->gl_driver, *texture_id, TRUE, TRUE);
@@ -2263,7 +2265,7 @@ add_offscreen_ops (GskGLRenderer   *self,
   ops_add (builder, &op);
   prev_projection = ops_set_projection (builder, &item_proj);
   prev_modelview = ops_set_modelview (builder, &identity);
-  prev_viewport = ops_set_viewport (builder, &GRAPHENE_RECT_INIT (min_x, min_y, max_x - min_x, max_y - 
min_y));
+  prev_viewport = ops_set_viewport (builder, &GRAPHENE_RECT_INIT (min_x, min_y, width, height));
 
   gsk_gl_renderer_add_render_ops (self, child_node, builder);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]