[gtk/image-loading: 35/36] !fixup memorytexture even more evil by using gdk-pixbuf




commit 9b5271393ff9964e429f9f3b64b913e4531e0d2b
Author: Benjamin Otte <otte redhat com>
Date:   Tue Sep 14 04:47:46 2021 +0200

    !fixup memorytexture even more evil by using gdk-pixbuf

 testsuite/gdk/memorytexture.c | 44 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)
---
diff --git a/testsuite/gdk/memorytexture.c b/testsuite/gdk/memorytexture.c
index bc45a32c4b..020d6927e4 100644
--- a/testsuite/gdk/memorytexture.c
+++ b/testsuite/gdk/memorytexture.c
@@ -13,7 +13,9 @@ typedef enum {
   TEXTURE_METHOD_GL,
   TEXTURE_METHOD_GL_RELEASED,
   TEXTURE_METHOD_PNG,
+  TEXTURE_METHOD_PNG_PIXBUF,
   TEXTURE_METHOD_TIFF,
+  TEXTURE_METHOD_TIFF_PIXBUF,
 
   N_TEXTURE_METHODS
 } TextureMethod;
@@ -461,6 +463,26 @@ create_texture (GdkMemoryFormat  format,
       }
       break;
 
+    case TEXTURE_METHOD_PNG_PIXBUF:
+      {
+        GInputStream *stream;
+        GdkPixbuf *pixbuf;
+        GBytes *bytes;
+
+        bytes = gdk_texture_save_to_png_bytes (texture);
+        g_assert (bytes);
+        g_object_unref (texture);
+        stream = g_memory_input_stream_new_from_bytes (bytes);
+        pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
+        g_object_unref (stream);
+        g_assert (pixbuf);
+        texture = gdk_texture_new_for_pixbuf (pixbuf);
+        g_assert (texture);
+        g_object_unref (pixbuf);
+        g_bytes_unref (bytes);
+      }
+      break;
+
     case TEXTURE_METHOD_TIFF:
       {
         GBytes *bytes = gdk_texture_save_to_tiff_bytes (texture);
@@ -472,6 +494,26 @@ create_texture (GdkMemoryFormat  format,
       }
       break;
 
+    case TEXTURE_METHOD_TIFF_PIXBUF:
+      {
+        GInputStream *stream;
+        GdkPixbuf *pixbuf;
+        GBytes *bytes;
+
+        bytes = gdk_texture_save_to_png_bytes (texture);
+        g_assert (bytes);
+        g_object_unref (texture);
+        stream = g_memory_input_stream_new_from_bytes (bytes);
+        pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
+        g_object_unref (stream);
+        g_assert (pixbuf);
+        texture = gdk_texture_new_for_pixbuf (pixbuf);
+        g_assert (texture);
+        g_object_unref (pixbuf);
+        g_bytes_unref (bytes);
+      }
+      break;
+
     case N_TEXTURE_METHODS:
     default:
       g_assert_not_reached ();
@@ -608,7 +650,7 @@ add_test (const char    *name,
     {
       for (method = 0; method < N_TEXTURE_METHODS; method++)
         {
-          const char *method_names[N_TEXTURE_METHODS] = { "local", "gl", "gl-released", "png", "tiff" };
+          const char *method_names[N_TEXTURE_METHODS] = { "local", "gl", "gl-released", "png", "png-pixbuf", 
"tiff", "tiff-pixbuf" };
           char *test_name = g_strdup_printf ("%s/%s/%s",
                                              name,
                                              g_enum_get_value (enum_class, format)->value_nick,


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