[gtk/image-loading: 28/28] texture: Avoid pixbufs when loading resources
- From: Matthias Clasen <matthiasc src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gtk/image-loading: 28/28] texture: Avoid pixbufs when loading resources
 
- Date: Tue, 14 Sep 2021 12:53:58 +0000 (UTC)
 
commit 0e9932307bfe7561735d4b65bbea3db7ecfe53d8
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Sep 14 08:52:35 2021 -0400
    texture: Avoid pixbufs when loading resources
    
    We can just use our own loaders here now.
 gdk/gdktexture.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c
index 4573acc06c..b83a859c5d 100644
--- a/gdk/gdktexture.c
+++ b/gdk/gdktexture.c
@@ -354,18 +354,18 @@ gdk_texture_new_for_pixbuf (GdkPixbuf *pixbuf)
 GdkTexture *
 gdk_texture_new_from_resource (const char *resource_path)
 {
-  GError *error = NULL;
+  GBytes *bytes;
   GdkTexture *texture;
-  GdkPixbuf *pixbuf;
+  GError *error = NULL;
 
   g_return_val_if_fail (resource_path != NULL, NULL);
 
-  pixbuf = gdk_pixbuf_new_from_resource (resource_path, &error);
-  if (pixbuf == NULL)
+  bytes = g_resources_lookup_data (resource_path, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL);
+  texture = gdk_texture_new_from_bytes (bytes, &error);
+  if (texture == NULL)
     g_error ("Resource path %s is not a valid image: %s", resource_path, error->message);
 
-  texture = gdk_texture_new_for_pixbuf (pixbuf);
-  g_object_unref (pixbuf);
+  g_bytes_unref (bytes);
 
   return texture;
 }
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]