Commit 4d3a07c5 authored by Timm Bäder's avatar Timm Bäder 👎

widget: Push transform node when neccessary

parent 020857e3
......@@ -13011,6 +13011,7 @@ gtk_widget_create_render_node (GtkWidget *widget,
GtkWidgetClass *klass = GTK_WIDGET_GET_CLASS (widget);
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
const gboolean needs_transform = !graphene_matrix_is_identity (&priv->transform);
    1. const gboolean ?

    2. Should we do this check in gtk_snapshot_push_transform() instead?

  • It's const because it can be and I don't want to risk anything changing it between the push/pop places where we use its value.

    Not sure about push_transform. We probably should, we do similar checks everywhere after all. It's mostly irrelevant here though since almost every widget is at least translated. A "is this matrix nothing but a translation" check would be better to do when setting the matrix in size_allocate I think since it would be fairly costly to do on every snapshot().

Please register or sign in to reply
GtkCssValue *filter_value;
double opacity;
GtkCssStyle *style;
......@@ -13030,6 +13031,9 @@ gtk_widget_create_render_node (GtkWidget *widget,
G_OBJECT_TYPE_NAME (widget), widget,
allocation.width, allocation.height);
if (needs_transform)
gtk_snapshot_push_transform (snapshot, &priv->transform);
filter_value = _gtk_style_context_peek_property (_gtk_widget_get_style_context (widget), GTK_CSS_PROPERTY_FILTER);
gtk_css_filter_value_push_snapshot (filter_value, snapshot);
......@@ -13089,7 +13093,10 @@ gtk_widget_create_render_node (GtkWidget *widget,
gtk_widget_maybe_add_debug_render_nodes (widget, snapshot);
gtk_snapshot_pop (snapshot);
if (needs_transform)
gtk_snapshot_pop (snapshot);
gtk_snapshot_pop (snapshot); /* Debug */
return gtk_snapshot_free_to_node (snapshot);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment