[gtk/wip/baedert/for-master] 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] widget: Try to reuse priv->transform when allocating
- Date: Fri, 21 Feb 2020 11:50:47 +0000 (UTC)
commit 4d74c9e3ba722bdbed45012ef3e52288212812f7
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 | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a306c95108..044f00a413 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4074,8 +4074,36 @@ 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]