[gtk/wip/baedert/for-master: 77/86] widget: Try to reuse priv->transform when allocating
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 77/86] widget: Try to reuse priv->transform when allocating
- Date: Sun, 23 Feb 2020 11:26:06 +0000 (UTC)
commit 51eac4ee6e311bc58f4173642fed45a9eaa55c7a
Author: Timm Bäder <mail baedert org>
Date: Fri Feb 21 12:49:10 2020 +0100
widget: Try to reuse priv->transform when allocating
gtk/gtkwidget.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index b56c5b4f29..e88eb91790 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4167,8 +4167,35 @@ gtk_widget_allocate (GtkWidget *widget,
border.bottom + padding.bottom;
if (baseline >= 0)
baseline -= margin.top + border.top + padding.top;
+
if (adjusted.x || adjusted.y)
- transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (adjusted.x, adjusted.y));
+ {
+ if (css_transform)
+ {
+ transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (adjusted.x, adjusted.y));
+ }
+ else
+ {
+ if (gsk_transform_get_category (priv->transform) == GSK_TRANSFORM_CATEGORY_2D_TRANSLATE &&
+ gsk_transform_get_category (transform) == GSK_TRANSFORM_CATEGORY_2D_TRANSLATE)
+ {
+ float old_x, old_y;
+ float new_x, new_y;
+
+ gsk_transform_to_translate (priv->transform, &old_x, &old_y);
+ gsk_transform_to_translate (transform, &new_x, &new_y);
+
+ if (old_x == new_x + adjusted.x && old_y == new_y + adjusted.y)
+ transform = gsk_transform_ref (priv->transform);
+ else
+ transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (adjusted.x,
adjusted.y));
+ }
+ else
+ {
+ transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (adjusted.x, adjusted.y));
+ }
+ }
+ }
gsk_transform_unref (priv->transform);
priv->transform = transform;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]