[gtk/wip/baedert/for-master] 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] widget: Try to reuse allocated_transform in size_allocate()
- Date: Fri, 21 Feb 2020 11:50:42 +0000 (UTC)
commit 43245a39514209fba6c87aba773e85674099872c
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 2a717863e7..a306c95108 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3865,9 +3865,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]