diff options
author | Victor Kareh <[email protected]> | 2018-04-02 22:02:39 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-04-05 09:09:50 +0200 |
commit | dade92d4f1edb6f47933e77229801971cb458ef1 (patch) | |
tree | db2545721a093328979a305a2c92e428ad65e230 /libcaja-private/caja-icon-info.c | |
parent | 556663ac4b8eb03b86fa70eeb6b959e1d27281e2 (diff) | |
download | caja-dade92d4f1edb6f47933e77229801971cb458ef1.tar.bz2 caja-dade92d4f1edb6f47933e77229801971cb458ef1.tar.xz |
HiDPI: Convert Pixbufs to Cairo Surfaces
This allows icons in most places to scale up properly for HiDPI
displays.
Diffstat (limited to 'libcaja-private/caja-icon-info.c')
-rw-r--r-- | libcaja-private/caja-icon-info.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/libcaja-private/caja-icon-info.c b/libcaja-private/caja-icon-info.c index 70b75ecb..75c3330c 100644 --- a/libcaja-private/caja-icon-info.c +++ b/libcaja-private/caja-icon-info.c @@ -558,6 +558,18 @@ caja_icon_info_get_pixbuf_nodefault (CajaIconInfo *icon) return res; } +cairo_surface_t * +caja_icon_info_get_surface_nodefault (CajaIconInfo *icon) +{ + GdkPixbuf *pixbuf; + cairo_surface_t *surface; + + pixbuf = caja_icon_info_get_pixbuf_nodefault (icon); + surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, icon->orig_scale, NULL); + g_object_unref (pixbuf); + + return surface; +} GdkPixbuf * caja_icon_info_get_pixbuf (CajaIconInfo *icon) @@ -581,6 +593,19 @@ caja_icon_info_get_pixbuf (CajaIconInfo *icon) return res; } +cairo_surface_t * +caja_icon_info_get_surface (CajaIconInfo *icon) +{ + GdkPixbuf *pixbuf; + cairo_surface_t *surface; + + pixbuf = caja_icon_info_get_pixbuf (icon); + surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, icon->orig_scale, NULL); + g_object_unref (pixbuf); + + return surface; +} + GdkPixbuf * caja_icon_info_get_pixbuf_nodefault_at_size (CajaIconInfo *icon, gsize forced_size) @@ -610,6 +635,19 @@ caja_icon_info_get_pixbuf_nodefault_at_size (CajaIconInfo *icon, return scaled_pixbuf; } +cairo_surface_t * +caja_icon_info_get_surface_nodefault_at_size (CajaIconInfo *icon, + gsize forced_size) +{ + GdkPixbuf *pixbuf; + cairo_surface_t *surface; + + pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (icon, forced_size); + surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, icon->orig_scale, NULL); + g_object_unref (pixbuf); + + return surface; +} GdkPixbuf * caja_icon_info_get_pixbuf_at_size (CajaIconInfo *icon, @@ -621,6 +659,9 @@ caja_icon_info_get_pixbuf_at_size (CajaIconInfo *icon, pixbuf = caja_icon_info_get_pixbuf (icon); + if (pixbuf == NULL) + return NULL; + w = gdk_pixbuf_get_width (pixbuf) / icon->orig_scale; h = gdk_pixbuf_get_height (pixbuf) / icon->orig_scale; s = MAX (w, h); @@ -637,6 +678,20 @@ caja_icon_info_get_pixbuf_at_size (CajaIconInfo *icon, return scaled_pixbuf; } +cairo_surface_t * +caja_icon_info_get_surface_at_size (CajaIconInfo *icon, + gsize forced_size) +{ + GdkPixbuf *pixbuf; + cairo_surface_t *surface; + + pixbuf = caja_icon_info_get_pixbuf_at_size (icon, forced_size); + surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, icon->orig_scale, NULL); + g_object_unref (pixbuf); + + return surface; +} + gboolean caja_icon_info_get_embedded_rect (CajaIconInfo *icon, GdkRectangle *rectangle) |