diff options
author | Benjamin Otte <otte@redhat.com> | 2019-02-21 06:27:30 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2019-02-21 19:47:28 +0100 |
commit | ad58dd5cf5670a6a39e1771a0452e9dad1276e7b (patch) | |
tree | c8d0b79820f754297c6c2ea442615d6978cf3a81 /gtk/gtkrendericon.c | |
parent | 4052bb2535d71a0259af2f4c2edaa18a0cd16799 (diff) | |
download | gtk+-ad58dd5cf5670a6a39e1771a0452e9dad1276e7b.tar.gz |
csstransform: Create a GtkTransform
Stop creating graphene_matrix_t's.
Diffstat (limited to 'gtk/gtkrendericon.c')
-rw-r--r-- | gtk/gtkrendericon.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c index f79862fa73..df855a853c 100644 --- a/gtk/gtkrendericon.c +++ b/gtk/gtkrendericon.c @@ -29,6 +29,7 @@ #include "gtkcsstransformvalueprivate.h" #include "gtkiconthemeprivate.h" #include "gtksnapshot.h" +#include "gtktransform.h" #include <math.h> @@ -40,7 +41,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, GtkCssImageBuiltinType builtin_type) { const GtkCssValue *shadows_value, *transform_value, *filter_value; - graphene_matrix_t transform_matrix; + GtkTransform *transform; GtkCssImage *image; gboolean has_shadow; @@ -58,8 +59,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, transform_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM); filter_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_FILTER); - if (!gtk_css_transform_value_get_matrix (transform_value, &transform_matrix)) - return; + transform = gtk_css_transform_value_get_transform (transform_value); gtk_snapshot_push_debug (snapshot, "CSS Icon @ %gx%g", width, height); @@ -67,7 +67,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, has_shadow = gtk_css_shadows_value_push_snapshot (shadows_value, snapshot); - if (graphene_matrix_is_identity (&transform_matrix)) + if (transform == NULL) { gtk_css_image_builtin_snapshot (image, snapshot, width, height, builtin_type); } @@ -77,7 +77,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, /* XXX: Implement -gtk-icon-transform-origin instead of hardcoding "50% 50%" here */ gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2.0, height / 2.0)); - gtk_snapshot_transform_matrix (snapshot, &transform_matrix); + gtk_snapshot_transform (snapshot, transform); gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- width / 2.0, - height / 2.0)); gtk_css_image_builtin_snapshot (image, snapshot, width, height, builtin_type); @@ -91,6 +91,8 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, gtk_css_filter_value_pop_snapshot (filter_value, snapshot); gtk_snapshot_pop (snapshot); + + gtk_transform_unref (transform); } void @@ -102,7 +104,7 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style, gboolean recolor) { const GtkCssValue *shadows_value, *transform_value, *filter_value; - graphene_matrix_t transform_matrix; + GtkTransform *transform; gboolean has_shadow; g_return_if_fail (GTK_IS_CSS_STYLE (style)); @@ -115,8 +117,7 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style, transform_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM); filter_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_FILTER); - if (!gtk_css_transform_value_get_matrix (transform_value, &transform_matrix)) - return; + transform = gtk_css_transform_value_get_transform (transform_value); gtk_css_filter_value_push_snapshot (filter_value, snapshot); @@ -144,7 +145,7 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style, gtk_snapshot_push_color_matrix (snapshot, &color_matrix, &color_offset); } - if (graphene_matrix_is_identity (&transform_matrix)) + if (transform == NULL) { gdk_paintable_snapshot (paintable, snapshot, width, height); } @@ -154,7 +155,7 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style, /* XXX: Implement -gtk-icon-transform-origin instead of hardcoding "50% 50%" here */ gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2.0, height / 2.0)); - gtk_snapshot_transform_matrix (snapshot, &transform_matrix); + gtk_snapshot_transform (snapshot, transform); gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- width / 2.0, - height / 2.0)); gdk_paintable_snapshot (paintable, snapshot, width, height); @@ -170,4 +171,6 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style, transparent: gtk_css_filter_value_pop_snapshot (filter_value, snapshot); + + gtk_transform_unref (transform); } |