[gdk-pixbuf] io: Also handle compressed GdkPixdata when loading from GResources
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] io: Also handle compressed GdkPixdata when loading from GResources
- Date: Mon, 19 Dec 2016 12:48:07 +0000 (UTC)
commit 0af5d60d0247e49ac6cc76f8b0c2af36bd20d391
Author: Bastien Nocera <hadess hadess net>
Date: Mon Dec 19 13:32:13 2016 +0100
io: Also handle compressed GdkPixdata when loading from GResources
https://bugzilla.gnome.org/show_bug.cgi?id=776105
gdk-pixbuf/gdk-pixbuf-io.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 3e9e868..40249ca 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -1654,19 +1654,18 @@ gdk_pixbuf_new_from_stream (GInputStream *stream,
}
GdkPixbuf *
-_gdk_pixbuf_new_from_resource_try_mmap (const char *resource_path)
+_gdk_pixbuf_new_from_resource_try_pixdata (const char *resource_path)
{
guint32 flags;
gsize data_size;
GBytes *bytes;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- /* We specialize uncompressed GdkPixdata files, making these a reference to the
- * compiled-in resource data
+ /* We specialize GdkPixdata files, making these a reference to the
+ * compiled-in resource data, whether uncompressed and mmap'ed, or
+ * compressed, and uncompressed on-the-fly.
*/
if (g_resources_get_info (resource_path, 0, &data_size, &flags, NULL) &&
- (flags & G_RESOURCE_FLAGS_COMPRESSED) == 0 &&
- data_size >= GDK_PIXDATA_HEADER_LENGTH &&
(bytes = g_resources_lookup_data (resource_path, 0, NULL)) != NULL) {
GdkPixbuf*pixbuf = NULL;
const guint8 *stream = g_bytes_get_data (bytes, NULL);
@@ -1716,7 +1715,7 @@ gdk_pixbuf_new_from_resource (const gchar *resource_path,
GInputStream *stream;
GdkPixbuf *pixbuf;
- pixbuf = _gdk_pixbuf_new_from_resource_try_mmap (resource_path);
+ pixbuf = _gdk_pixbuf_new_from_resource_try_pixdata (resource_path);
if (pixbuf)
return pixbuf;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]