summaryrefslogtreecommitdiff
path: root/src/core/window.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2021-06-18 11:13:17 -0400
committerVictor Kareh <[email protected]>2023-03-07 14:24:09 -0500
commit32f1967142a078ecdb4222c05d62c75710fb74fa (patch)
tree2e2b83dd71fd33522f4e6d5efa76d837f1901e6f /src/core/window.c
parentdf299574f6db9bcdccc9413f173c2dd4ceff6467 (diff)
downloadmarco-32f1967142a078ecdb4222c05d62c75710fb74fa.tar.bz2
marco-32f1967142a078ecdb4222c05d62c75710fb74fa.tar.xz
iconcache: Read icons into cairo surfaces
We internally read icons as cairo surfaces before converting them to GdkPixbuf. This will allow us to eventually delete a lot of GdkPixbuf manipulation and simplify the drawing codepath.
Diffstat (limited to 'src/core/window.c')
-rw-r--r--src/core/window.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/core/window.c b/src/core/window.c
index 4c90fee4..08cd99c7 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -6111,13 +6111,11 @@ redraw_icon (MetaWindow *window)
void
meta_window_update_icon_now (MetaWindow *window)
{
- GdkPixbuf *icon;
- GdkPixbuf *mini_icon;
-
- icon = NULL;
- mini_icon = NULL;
+ cairo_surface_t *icon = NULL;
+ cairo_surface_t *mini_icon = NULL;
int icon_size = meta_prefs_get_icon_size();
+ int scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
if (meta_read_icons (window->screen,
window->xwindow,
@@ -6128,7 +6126,8 @@ meta_window_update_icon_now (MetaWindow *window)
&icon,
icon_size,
&mini_icon,
- META_MINI_ICON_SIZE))
+ META_MINI_ICON_SIZE,
+ scale))
{
if (window->icon)
g_object_unref (G_OBJECT (window->icon));
@@ -6136,8 +6135,15 @@ meta_window_update_icon_now (MetaWindow *window)
if (window->mini_icon)
g_object_unref (G_OBJECT (window->mini_icon));
- window->icon = icon;
- window->mini_icon = mini_icon;
+ window->icon = gdk_pixbuf_get_from_surface (icon,
+ 0, 0,
+ icon_size, icon_size);
+ cairo_surface_destroy (icon);
+
+ window->mini_icon = gdk_pixbuf_get_from_surface (mini_icon,
+ 0, 0,
+ META_MINI_ICON_SIZE, META_MINI_ICON_SIZE);
+ cairo_surface_destroy (mini_icon);
redraw_icon (window);
}