[gtk/wip/baedert/for-master: 53/66] 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: 53/66] widget: Try to reuse allocated_transform in size_allocate()
- Date: Tue, 25 Feb 2020 09:53:07 +0000 (UTC)
commit 44c75407e44e271fec69cdf32e47ae5f3818a61a
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 d15df4c1fd..b56c5b4f29 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]