[gtk/wip/baedert/for-master: 12/12] gl renderer: Don't reset offset when drawing offscreen




commit 227a47910c142821a540d0e304967587c696f824
Author: Timm Bäder <mail baedert org>
Date:   Sun Jan 10 19:51:27 2021 +0100

    gl renderer: Don't reset offset when drawing offscreen

 gsk/gl/gskglrenderer.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 9d38e4787a..4892b75ce3 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -1755,8 +1755,8 @@ render_rounded_clip_node (GskGLRenderer       *self,
        *
        *       We do, however, apply the scale factor to the child clip of course.
        */
-      scaled_clip.bounds.origin.x = clip->bounds.origin.x * scale_x;
-      scaled_clip.bounds.origin.y = clip->bounds.origin.y * scale_y;
+      scaled_clip.bounds.origin.x = (builder->dx + clip->bounds.origin.x) * scale_x;
+      scaled_clip.bounds.origin.y = (builder->dy + clip->bounds.origin.y) * scale_y;
       scaled_clip.bounds.size.width = clip->bounds.size.width * scale_x;
       scaled_clip.bounds.size.height = clip->bounds.size.height * scale_y;
 
@@ -3831,9 +3831,9 @@ add_offscreen_ops (GskGLRenderer         *self,
                    gboolean              *is_offscreen,
                    guint                  flags)
 {
-  float width, height;
   const float dx = builder->dx;
   const float dy = builder->dy;
+  float width, height;
   float scale_x;
   float scale_y;
   int render_target;
@@ -3932,8 +3932,8 @@ add_offscreen_ops (GskGLRenderer         *self,
                                           render_target);
     }
 
-  viewport = GRAPHENE_RECT_INIT (bounds->origin.x * scale_x,
-                                 bounds->origin.y * scale_y,
+  viewport = GRAPHENE_RECT_INIT ((bounds->origin.x + dx) * scale_x,
+                                 (bounds->origin.y + dy) * scale_y,
                                  width, height);
 
   init_projection_matrix (&item_proj, &viewport);
@@ -3946,8 +3946,8 @@ add_offscreen_ops (GskGLRenderer         *self,
   if (flags & RESET_CLIP)
     ops_push_clip (builder, &GSK_ROUNDED_RECT_INIT_FROM_RECT (viewport));
 
-  builder->dx = 0;
-  builder->dy = 0;
+  builder->dx = dx;
+  builder->dy = dy;
 
   prev_opacity = ops_set_opacity (builder, 1.0);
 


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