[gtk/wip/baedert/for-master: 2/6] gl renderer: Ignore crossfades between equal texture nodes




commit e32331d002fbca8779d71029f455c25ef65d0173
Author: Timm Bäder <mail baedert org>
Date:   Sat Dec 5 13:13:15 2020 +0100

    gl renderer: Ignore crossfades between equal texture nodes

 gsk/gl/gskglrenderer.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 7d26d9b838..0149fa2598 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -244,6 +244,21 @@ _graphene_rect_contains_rect (const graphene_rect_t *r1,
   return false;
 }
 
+static inline bool G_GNUC_PURE
+equal_texture_nodes (GskRenderNode *node1,
+                     GskRenderNode *node2)
+{
+  if (gsk_render_node_get_node_type (node1) != GSK_TEXTURE_NODE ||
+      gsk_render_node_get_node_type (node2) != GSK_TEXTURE_NODE)
+    return false;
+
+  if (gsk_texture_node_get_texture (node1) !=
+      gsk_texture_node_get_texture (node2))
+    return false;
+
+  return graphene_rect_equal (&node1->bounds, &node2->bounds);
+}
+
 static inline void
 sort_border_sides (const GdkRGBA *colors,
                    int           *indices)
@@ -2656,6 +2671,12 @@ render_cross_fade_node (GskGLRenderer   *self,
       return;
     }
 
+  if (equal_texture_nodes (start_node, end_node))
+    {
+      gsk_gl_renderer_add_render_ops (self, end_node, builder);
+      return;
+    }
+
   /* TODO: We create 2 textures here as big as the cross-fade node, but both the
    * start and the end node might be a lot smaller than that. */
 


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