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
This commit is contained in:
Benjamin Otte 2018-06-27 20:52:23 +02:00
parent 8aa4b5150e
commit f3c670ab0c

View File

@ -13159,6 +13159,10 @@ gtk_widget_create_render_node (GtkWidget *widget,
GtkBorder margin, border, padding; GtkBorder margin, border, padding;
GtkSnapshot *snapshot; GtkSnapshot *snapshot;
opacity = priv->alpha / 255.0;
if (opacity <= 0.0)
return NULL;
snapshot = gtk_snapshot_new (); snapshot = gtk_snapshot_new ();
_gtk_widget_get_allocation (widget, &allocation); _gtk_widget_get_allocation (widget, &allocation);
@ -13174,7 +13178,6 @@ gtk_widget_create_render_node (GtkWidget *widget,
get_box_margin (style, &margin); get_box_margin (style, &margin);
get_box_border (style, &border); get_box_border (style, &border);
get_box_padding (style, &padding); get_box_padding (style, &padding);
opacity = priv->alpha / 255.0;
if (opacity < 1.0) if (opacity < 1.0)
gtk_snapshot_push_opacity (snapshot, opacity); gtk_snapshot_push_opacity (snapshot, opacity);
@ -13223,7 +13226,6 @@ gtk_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot) GtkSnapshot *snapshot)
{ {
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
double opacity;
if (!_gtk_widget_is_drawable (widget)) if (!_gtk_widget_is_drawable (widget))
return; return;
@ -13234,10 +13236,6 @@ gtk_widget_snapshot (GtkWidget *widget,
return; return;
} }
opacity = priv->alpha / 255.0;
if (opacity <= 0.0)
return;
if (priv->draw_needed) if (priv->draw_needed)
{ {
GskRenderNode *render_node; GskRenderNode *render_node;