summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-icon-info.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2018-04-02 22:02:39 -0400
committerlukefromdc <[email protected]>2018-04-04 21:53:21 -0400
commit554a036710b18d2573810265c69be6e83033af63 (patch)
tree8e0b03a463952ad43f356301e91d0c1ced4fabad /libcaja-private/caja-icon-info.c
parent280ef8294b0e50394b5118cb298b0f9e5920f795 (diff)
downloadcaja-554a036710b18d2573810265c69be6e83033af63.tar.bz2
caja-554a036710b18d2573810265c69be6e83033af63.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.c55
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)