[gtk+] snapshot: Use a better placeholder



commit 672fb6087992df7a6232609ec4e37b4505a8f365
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 8 22:19:22 2017 -0400

    snapshot: Use a better placeholder
    
    An empty container has the same effect as transparency
    with the cairo renderer, but creates black with Vulkan.
    To avoid this, explicitly use a transparent color node.
    
    This fixes the css blendmode example in gtk4-demo with
    the Vulkan renderer.

 gtk/gtksnapshot.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index 5d2a7f1..2f72614 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -746,15 +746,18 @@ gtk_snapshot_collect_blend_top (GtkSnapshot      *snapshot,
                                 const char       *name)
 {
   GskRenderNode *bottom_node, *top_node, *blend_node;
+  GdkRGBA transparent = { 0, 0, 0, 0 };
 
   top_node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name);
   bottom_node = state->data.blend.bottom_node;
 
+  g_assert (top_node != NULL || bottom_node != NULL);
+
   /* XXX: Is this necessary? Do we need a NULL node? */
   if (top_node == NULL)
-    top_node = gsk_container_node_new (NULL, 0);
+    top_node = gsk_color_node_new (&transparent, &bottom_node->bounds);
   if (bottom_node == NULL)
-    bottom_node = gsk_container_node_new (NULL, 0);
+    bottom_node = gsk_color_node_new (&transparent, &top_node->bounds);
 
   blend_node = gsk_blend_node_new (bottom_node, top_node, state->data.blend.blend_mode);
   gsk_render_node_set_name (blend_node, name);


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