[gtk/transparent-optimizations: 1/3] snapshot: Handle transparent opacity nodes correctly




commit aaa68954c34a31fb95b717f2fed6736037e0d644
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jul 15 13:14:13 2021 -0400

    snapshot: Handle transparent opacity nodes correctly
    
    Eliding totally transparent content from the node tree is
    not 100% correct, since filters can make things visible, so
    we need to at least preserve the bounds. We can do that by
    creating a transparent color node.

 gtk/gtksnapshot.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index b0b1222c66..ad5533982a 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -30,6 +30,8 @@
 #include "gtkstylecontextprivate.h"
 #include "gsktransformprivate.h"
 
+#include "gdk/gdkrgbaprivate.h"
+
 #include "gsk/gskrendernodeprivate.h"
 #include "gsk/gskroundedrectprivate.h"
 
@@ -461,8 +463,12 @@ gtk_snapshot_collect_opacity (GtkSnapshot      *snapshot,
     }
   else if (state->data.opacity.opacity == 0.0)
     {
+      GdkRGBA color = GDK_RGBA ("00000000");
+      graphene_rect_t bounds;
+
+      gsk_render_node_get_bounds (node, &bounds);
+      opacity_node = gsk_color_node_new (&color, &bounds);
       gsk_render_node_unref (node);
-      opacity_node = NULL;
     }
   else
     {


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