[gtk/wip/baedert/for-master: 94/97] 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: 94/97] widget: Try to reuse allocated_transform in size_allocate()
- Date: Fri, 21 Feb 2020 12:23:17 +0000 (UTC)
commit e0fa8db659a65506b88ba5ad725a88f0bfc7ede4
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..5760faa78d 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]