[gtk/wip/otte/transform: 22/37] rendericon: Use new snapshot transforms
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/transform: 22/37] rendericon: Use new snapshot transforms
- Date: Thu, 21 Feb 2019 06:22:40 +0000 (UTC)
commit 2d06b14083978fe76c64e263c100ac0242faf0e1
Author: Benjamin Otte <otte redhat com>
Date: Thu Feb 21 05:34:12 2019 +0100
rendericon: Use new snapshot transforms
gtk/gtkrendericon.c | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c
index a4d867001f..f79862fa73 100644
--- a/gtk/gtkrendericon.c
+++ b/gtk/gtkrendericon.c
@@ -73,19 +73,16 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style,
}
else
{
- graphene_matrix_t m1, m2, m3;
+ gtk_snapshot_save (snapshot);
/* XXX: Implement -gtk-icon-transform-origin instead of hardcoding "50% 50%" here */
- graphene_matrix_init_translate (&m1, &GRAPHENE_POINT3D_INIT (width / 2.0, height / 2.0, 0));
- graphene_matrix_multiply (&transform_matrix, &m1, &m3);
- graphene_matrix_init_translate (&m2, &GRAPHENE_POINT3D_INIT (- width / 2.0, - height / 2.0, 0));
- graphene_matrix_multiply (&m2, &m3, &m1);
-
- gtk_snapshot_push_transform (snapshot, &m1);
+ gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2.0, height / 2.0));
+ gtk_snapshot_transform_matrix (snapshot, &transform_matrix);
+ gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- width / 2.0, - height / 2.0));
gtk_css_image_builtin_snapshot (image, snapshot, width, height, builtin_type);
- gtk_snapshot_pop (snapshot);
+ gtk_snapshot_restore (snapshot);
}
if (has_shadow)
@@ -153,19 +150,16 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style,
}
else
{
- graphene_matrix_t m1, m2, m3;
+ gtk_snapshot_save (snapshot);
/* XXX: Implement -gtk-icon-transform-origin instead of hardcoding "50% 50%" here */
- graphene_matrix_init_translate (&m1, &GRAPHENE_POINT3D_INIT (width / 2.0, height / 2.0, 0));
- graphene_matrix_multiply (&transform_matrix, &m1, &m3);
- graphene_matrix_init_translate (&m2, &GRAPHENE_POINT3D_INIT (- width / 2.0, - height / 2.0, 0));
- graphene_matrix_multiply (&m2, &m3, &m1);
-
- gtk_snapshot_push_transform (snapshot, &m1);
+ gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2.0, height / 2.0));
+ gtk_snapshot_transform_matrix (snapshot, &transform_matrix);
+ gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- width / 2.0, - height / 2.0));
gdk_paintable_snapshot (paintable, snapshot, width, height);
- gtk_snapshot_pop (snapshot);
+ gtk_snapshot_restore (snapshot);
}
if (recolor)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]