From 675707d33e8b4610b5e18bacaa9d54a59e84c8fb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 30 Mar 2018 14:13:41 -0600 Subject: [PATCH] theme: use gtk_render_icon_suface to paint button icon Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1764558 Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/100 Forwarded: yes, https://gitlab.gnome.org/GNOME/mutter/merge_requests/62 This will properly take care of the icon transformations and of the shadow. Fixes #100 Gbp-Pq: Name theme-use-gtk_render_icon_suface-to-paint-button-icon.patch --- src/ui/theme.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/ui/theme.c b/src/ui/theme.c index c0bb9b6..c88ae54 100644 --- a/src/ui/theme.c +++ b/src/ui/theme.c @@ -890,21 +890,11 @@ meta_frame_layout_draw_with_style (MetaFrameLayout *layout, if (surface) { - float width, height; - int x, y; - - width = cairo_image_surface_get_width (surface) / scale; - height = cairo_image_surface_get_height (surface) / scale; - x = button_rect.x + (button_rect.width - layout->icon_size) / 2; - y = button_rect.y + (button_rect.height - layout->icon_size) / 2; - - cairo_translate (cr, x, y); - cairo_scale (cr, - layout->icon_size / width, - layout->icon_size / height); - cairo_set_source_surface (cr, surface, 0, 0); - cairo_paint (cr); + double x, y; + x = button_rect.x + (button_rect.width - layout->icon_size) / 2.0; + y = button_rect.y + (button_rect.height - layout->icon_size) / 2.0; + gtk_render_icon_surface (style, cr, surface, x, y); cairo_surface_destroy (surface); } } -- 2.30.2