[gtk/wip/baedert/gl-rework] Only call filter value api if we have a filter value



commit af8844f934159ed2178f38cd31cf02f80ed8e771
Author: Timm Bäder <mail baedert org>
Date:   Thu Jan 2 10:04:53 2020 +0100

    Only call filter value api if we have a filter value
    
    We usually don't have a filter value so it's confusing that we
    unconditionally call its API.

 gtk/gtkrendericon.c | 12 ++++++++----
 gtk/gtkwidget.c     |  3 ++-
 2 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c
index 6d37033bdc..ca36eec9bc 100644
--- a/gtk/gtkrendericon.c
+++ b/gtk/gtkrendericon.c
@@ -63,7 +63,8 @@ gtk_css_style_snapshot_icon (GtkCssStyle            *style,
 
   gtk_snapshot_push_debug (snapshot, "CSS Icon @ %gx%g", width, height);
 
-  gtk_css_filter_value_push_snapshot (filter_value, snapshot);
+  if (filter_value)
+    gtk_css_filter_value_push_snapshot (filter_value, snapshot);
 
   has_shadow = gtk_css_shadows_value_push_snapshot (shadows_value, snapshot);
 
@@ -88,7 +89,8 @@ gtk_css_style_snapshot_icon (GtkCssStyle            *style,
   if (has_shadow)
     gtk_snapshot_pop (snapshot);
 
-  gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
+  if (filter_value)
+    gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
 
   gtk_snapshot_pop (snapshot);
 
@@ -119,7 +121,8 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle  *style,
 
   transform = gtk_css_transform_value_get_transform (transform_value);
 
-  gtk_css_filter_value_push_snapshot (filter_value, snapshot);
+  if (filter_value)
+    gtk_css_filter_value_push_snapshot (filter_value, snapshot);
 
   has_shadow = gtk_css_shadows_value_push_snapshot (shadows_value, snapshot);
 
@@ -170,7 +173,8 @@ transparent:
   if (has_shadow)
     gtk_snapshot_pop (snapshot);
 
-  gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
+  if (filter_value)
+    gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
 
   gsk_transform_unref (transform);
 }
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 31a21ffd0f..6dfeb1c1e6 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -12698,7 +12698,8 @@ gtk_widget_create_render_node (GtkWidget   *widget,
   if (opacity < 1.0)
     gtk_snapshot_pop (snapshot);
 
-  gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
+  if (filter_value)
+    gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
 
 #ifdef G_ENABLE_DEBUG
   gtk_widget_maybe_add_debug_render_nodes (widget, snapshot);


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