[gtk] gl renderer: Pull out code from a loop



commit 27ddd39d69d3b738afdc477549ffffae6bdf4d3d
Author: Timm Bäder <mail baedert org>
Date:   Sat Jul 20 13:04:26 2019 +0200

    gl renderer: Pull out code from a loop
    
    Does not not actually depend on anything done inside the loop.

 gsk/gl/gskglrenderer.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 9d2d7b580a..b3c5b924da 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -1890,10 +1890,10 @@ render_shadow_node (GskGLRenderer       *self,
                     RenderOpBuilder     *builder,
                     const GskQuadVertex *vertex_data)
 {
-  float min_x = node->bounds.origin.x;
-  float min_y = node->bounds.origin.y;
-  float max_x = min_x + node->bounds.size.width;
-  float max_y = min_y + node->bounds.size.height;
+  float min_x;
+  float min_y;
+  float max_x;
+  float max_y;
   GskRenderNode *original_child = gsk_shadow_node_get_child (node);
   GskRenderNode *shadow_child = original_child;
   gsize n_shadows = gsk_shadow_node_get_n_shadows (node);
@@ -1919,6 +1919,11 @@ render_shadow_node (GskGLRenderer       *self,
       shadow_child = gsk_color_matrix_node_get_child (shadow_child);
     }
 
+  min_x = builder->dx + shadow_child->bounds.origin.x;
+  min_y = builder->dy + shadow_child->bounds.origin.y;
+  max_x = min_x + shadow_child->bounds.size.width;
+  max_y = min_y + shadow_child->bounds.size.height;
+
   for (i = 0; i < n_shadows; i ++)
     {
       const GskShadow *shadow = gsk_shadow_node_peek_shadow (node, i);
@@ -1940,11 +1945,6 @@ render_shadow_node (GskGLRenderer       *self,
       if (gdk_rgba_is_clear (&shadow->color))
         continue;
 
-      min_x = builder->dx + shadow_child->bounds.origin.x;
-      min_y = builder->dy + shadow_child->bounds.origin.y;
-      max_x = min_x + shadow_child->bounds.size.width;
-      max_y = min_y + shadow_child->bounds.size.height;
-
       /* Draw the child offscreen, without the offset. */
       add_offscreen_ops (self, builder,
                          &shadow_child->bounds,


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