[gtk/image-loading: 50/70] rendernodeparser: Avoid gdk_texture_new_for_pixbuf




commit f14f08ffa4abcf513377e2e62d01213acc487cf5
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 13 19:36:17 2021 -0400

    rendernodeparser: Avoid gdk_texture_new_for_pixbuf
    
    We can just use gdk_texture_new_from_bytes here now.
    
    Update affected test output.

 gsk/gskrendernodeparser.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c
index 6d2294dd06..3f87f4f3dc 100644
--- a/gsk/gskrendernodeparser.c
+++ b/gsk/gskrendernodeparser.c
@@ -85,24 +85,17 @@ parse_texture (GtkCssParser *parser,
   scheme = g_uri_parse_scheme (url);
   if (scheme && g_ascii_strcasecmp (scheme, "data") == 0)
     {
-      GInputStream *stream;
-      GdkPixbuf *pixbuf;
       GBytes *bytes;
 
-      texture = NULL;
-
       bytes = gtk_css_data_url_parse (url, NULL, &error);
       if (bytes)
         {
-          stream = g_memory_input_stream_new_from_bytes (bytes);
+          texture = gdk_texture_new_from_bytes (bytes, &error);
           g_bytes_unref (bytes);
-          pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, &error);
-          g_object_unref (stream);
-          if (pixbuf != NULL)
-            {
-              texture = gdk_texture_new_for_pixbuf (pixbuf);
-              g_object_unref (pixbuf);
-            }
+        }
+      else
+        {
+          texture = NULL;
         }
     }
   else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]