[gtk] widget: Push a transform node if we need to



commit ca2c05cdb371e4756444a4428f42825c73b2cced
Author: Timm Bäder <mail baedert org>
Date:   Sat Feb 16 15:29:05 2019 +0100

    widget: Push a transform node if we need to
    
    This is the same as the old code since the transformation only contains
    teh offset right now, but it will be different later where arbitrary
    transformations are possible per widget.

 gtk/gtkwidget.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 26dfa424e1..4e6ea25321 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -13528,16 +13528,21 @@ gtk_widget_snapshot_child (GtkWidget   *widget,
                            GtkWidget   *child,
                            GtkSnapshot *snapshot)
 {
-  int x, y;
+  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (child);
+  gboolean needs_transform;
 
   g_return_if_fail (_gtk_widget_get_parent (child) == widget);
   g_return_if_fail (snapshot != NULL);
 
-  gtk_widget_get_origin_relative_to_parent (child, &x, &y);
+  needs_transform = !graphene_matrix_is_identity (&priv->transform);
+
+  if (needs_transform)
+    gtk_snapshot_push_transform (snapshot, &priv->transform);
 
-  gtk_snapshot_offset (snapshot, x, y);
   gtk_widget_snapshot (child, snapshot);
-  gtk_snapshot_offset (snapshot, -x, -y);
+
+  if (needs_transform)
+    gtk_snapshot_pop (snapshot);
 }
 
 /**


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