[gtk/wip/baedert/transforms6: 261/273] widget: Only push a transform if we need to
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/transforms6: 261/273] widget: Only push a transform if we need to
- Date: Wed, 13 Feb 2019 09:15:13 +0000 (UTC)
commit 98b9119135c5011b54e35c7dc58400b0a0271867
Author: Timm Bäder <mail baedert org>
Date: Thu Nov 29 09:49:16 2018 +0100
widget: Only push a transform if we need to
gtk/gtkwidget.c | 12 ++++++++++--
gtk/gtkwidgetprivate.h | 1 +
2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 07ae137b05..175cdfda42 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2910,6 +2910,7 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
}
graphene_matrix_init_identity (&priv->transform);
+ priv->has_transform = FALSE;
/* this will be set to TRUE if the widget gets a child or if the
* expand flag is set on the widget, but until one of those happen
@@ -4335,6 +4336,7 @@ gtk_widget_size_allocate_transformed (GtkWidget *widget,
priv->allocation = real_allocation;
priv->allocated_baseline = baseline;
priv->transform = final_transform;
+ priv->has_transform = !graphene_matrix_is_identity (&final_transform);
if (!alloc_needed && !size_changed && !baseline_changed)
{
@@ -13589,9 +13591,13 @@ gtk_widget_snapshot_child (GtkWidget *widget,
g_return_if_fail (_gtk_widget_get_parent (child) == widget);
g_return_if_fail (snapshot != NULL);
- gtk_snapshot_push_transform (snapshot, &priv->transform);
+ if (priv->has_transform)
+ gtk_snapshot_push_transform (snapshot, &priv->transform);
+
gtk_widget_snapshot (child, snapshot);
- gtk_snapshot_pop (snapshot);
+
+ if (priv->has_transform)
+ gtk_snapshot_pop (snapshot);
}
/**
@@ -13831,6 +13837,8 @@ gtk_widget_set_transform (GtkWidget *widget,
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+ priv->has_transform = !graphene_matrix_is_identity (transform);
+
graphene_matrix_init_from_matrix (&priv->transform, transform);
}
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index fca15f566d..4e3c117d70 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -146,6 +146,7 @@ struct _GtkWidgetPrivate
graphene_matrix_t allocated_transform;
graphene_matrix_t transform;
+ guint has_transform : 1;
/* The widget's requested sizes */
SizeRequestCache requests;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]