[gtk] widget: Move opactiy == 0 check
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] widget: Move opactiy == 0 check
- Date: Wed, 27 Jun 2018 19:55:24 +0000 (UTC)
commit f3c670ab0cecb30f064163391a645d964f76ccbf
Author: Benjamin Otte <otte redhat com>
Date: Wed Jun 27 20:52:23 2018 +0200
widget: Move opactiy == 0 check
If we check it too early, we will not unset priv->draw_neeeded, which
will then cause queue_draw() calls to not have an effect later. And that
causes changes in opacity to not register.
Closes #1180
gtk/gtkwidget.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 2fea7f9143..581e27f870 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -13159,6 +13159,10 @@ gtk_widget_create_render_node (GtkWidget *widget,
GtkBorder margin, border, padding;
GtkSnapshot *snapshot;
+ opacity = priv->alpha / 255.0;
+ if (opacity <= 0.0)
+ return NULL;
+
snapshot = gtk_snapshot_new ();
_gtk_widget_get_allocation (widget, &allocation);
@@ -13174,7 +13178,6 @@ gtk_widget_create_render_node (GtkWidget *widget,
get_box_margin (style, &margin);
get_box_border (style, &border);
get_box_padding (style, &padding);
- opacity = priv->alpha / 255.0;
if (opacity < 1.0)
gtk_snapshot_push_opacity (snapshot, opacity);
@@ -13223,7 +13226,6 @@ gtk_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
- double opacity;
if (!_gtk_widget_is_drawable (widget))
return;
@@ -13234,10 +13236,6 @@ gtk_widget_snapshot (GtkWidget *widget,
return;
}
- opacity = priv->alpha / 255.0;
- if (opacity <= 0.0)
- return;
-
if (priv->draw_needed)
{
GskRenderNode *render_node;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]