[gtk/wip/baedert/for-master: 2/6] widget: Try to reuse allocated_transform in size_allocate()
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 2/6] widget: Try to reuse allocated_transform in size_allocate()
- Date: Sat, 22 Feb 2020 13:18:25 +0000 (UTC)
commit b3ae86aa13b9bac24255bcfa62a51dbfe800f4ce
Author: Timm Bäder <mail baedert org>
Date: Fri Feb 21 12:23:17 2020 +0100
widget: Try to reuse allocated_transform in size_allocate()
If they end up being the same transform anyway, just reuse the current
transform.
gtk/gtkwidget.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 40663ddb45..5756ebcfff 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3896,9 +3896,29 @@ gtk_widget_size_allocate (GtkWidget *widget,
GskTransform *transform;
if (allocation->x || allocation->y)
- transform = gsk_transform_translate (NULL, &GRAPHENE_POINT_INIT (allocation->x, allocation->y));
+ {
+ GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+
+ if (gsk_transform_get_category (priv->allocated_transform) == GSK_TRANSFORM_CATEGORY_2D_TRANSLATE)
+ {
+ float x, y;
+
+ gsk_transform_to_translate (priv->allocated_transform, &x, &y);
+
+ if (x == allocation->x && y == allocation->y)
+ transform = gsk_transform_ref (priv->allocated_transform);
+ else
+ transform = gsk_transform_translate (NULL, &GRAPHENE_POINT_INIT (allocation->x, allocation->y));
+ }
+ else
+ {
+ transform = gsk_transform_translate (NULL, &GRAPHENE_POINT_INIT (allocation->x, allocation->y));
+ }
+ }
else
- transform = NULL;
+ {
+ transform = NULL;
+ }
gtk_widget_allocate (widget,
allocation->width,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]