[gdk-pixbuf] lib: Deprecate GdkPixdata



commit 48d76fb7f2d059013f5781b199245274998f05c9
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Oct 21 19:24:11 2014 +0200

    lib: Deprecate GdkPixdata
    
    GdkPixdata has a number of problems, including:
    - it doesn't use the original files, losing metadata
    - its RLE compression is ineffecient, even more so for lossy formats
    - the way it's implemented doesn't support data > 64 kB on Windows
      (See https://bugzilla.gnome.org/show_bug.cgi?id=603706)

 gdk-pixbuf/gdk-pixdata.c |   13 +++++++++++++
 gdk-pixbuf/gdk-pixdata.h |    8 ++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixdata.c b/gdk-pixbuf/gdk-pixdata.c
index d0fe7d5..b4c5d7e 100644
--- a/gdk-pixbuf/gdk-pixdata.c
+++ b/gdk-pixbuf/gdk-pixdata.c
@@ -31,6 +31,9 @@
  * can be used to convert image files into #GdkPixdata structures suitable
  * for inclusion in C sources. To convert the #GdkPixdata structures back 
  * into #GdkPixbuf<!-- -->s, use gdk_pixbuf_from_pixdata.
+ *
+ * #GdkPixdata should not be used any more. #GResource should be used to save
+ * the original compressed images inside the program's binary.
  */
 
 #define APPEND g_string_append_printf
@@ -102,6 +105,8 @@ pixdata_get_length (const GdkPixdata *pixdata)
  * Return value: (array length=stream_length_p) (transfer full): A
  * newly-allocated string containing the serialized #GdkPixdata
  * structure.
+ *
+ * Deprecated: 2.32: Use #GResource instead.
  **/
 guint8* /* free result */
 gdk_pixdata_serialize (const GdkPixdata *pixdata,
@@ -194,6 +199,8 @@ get_uint32 (const guint8 *stream, guint *result)
  *
  * Return value: Upon successful deserialization %TRUE is returned,
  * %FALSE otherwise.
+ *
+ * Deprecated: 2.32: Use #GResource instead.
  **/
 gboolean
 gdk_pixdata_deserialize (GdkPixdata   *pixdata,
@@ -322,6 +329,8 @@ free_buffer (guchar *pixels, gpointer data)
  * Returns: (nullable): If @use_rle is %TRUE, a pointer to the
  *   newly-allocated memory for the run-length encoded pixel data,
  *   otherwise %NULL.
+ *
+ * Deprecated: 2.32: Use #GResource instead.
  **/
 gpointer
 gdk_pixdata_from_pixbuf (GdkPixdata      *pixdata,
@@ -410,6 +419,7 @@ gdk_pixdata_from_pixbuf (GdkPixdata      *pixdata,
  * newly-allocated memory; otherwise it is reused.
  *
  * Returns: (transfer full): a new #GdkPixbuf.
+ * Deprecated: 2.32: Use #GResource instead.
  **/
 GdkPixbuf*
 gdk_pixbuf_from_pixdata (const GdkPixdata *pixdata,
@@ -628,6 +638,7 @@ save_rle_decoder (GString     *gstring,
  *
  * Returns: a newly-allocated string containing the C source form
  *   of @pixdata.
+ * Deprecated: 2.32: Use #GResource instead.
  **/
 GString*
 gdk_pixdata_to_csource (GdkPixdata        *pixdata,
@@ -894,6 +905,8 @@ gdk_pixdata_to_csource (GdkPixdata        *pixdata,
  *
  * Return value: A newly-created #GdkPixbuf structure with a reference,
  *   count of 1, or %NULL if an error occurred.
+ *
+ * Deprecated: 2.32: Use #GResource instead.
  **/
 GdkPixbuf*
 gdk_pixbuf_new_from_inline (gint          data_length,
diff --git a/gdk-pixbuf/gdk-pixdata.h b/gdk-pixbuf/gdk-pixdata.h
index 51de915..3b34b5c 100644
--- a/gdk-pixbuf/gdk-pixdata.h
+++ b/gdk-pixbuf/gdk-pixdata.h
@@ -17,6 +17,7 @@
 #ifndef __GDK_PIXDATA_H__
 #define __GDK_PIXDATA_H__
 
+#ifndef GDK_PIXBUF_DISABLE_DEPRECATED
 #include        <gdk-pixbuf/gdk-pixbuf.h>
 
 G_BEGIN_DECLS
@@ -102,15 +103,19 @@ struct _GdkPixdata
 #define        GDK_PIXDATA_HEADER_LENGTH       (4 + 4 + 4 + 4 + 4 + 4)
 
 /* the returned stream is plain htonl of GdkPixdata members + pixel_data */
+G_DEPRECATED
 guint8*                gdk_pixdata_serialize   (const GdkPixdata       *pixdata,
                                         guint                  *stream_length_p);
+G_DEPRECATED
 gboolean       gdk_pixdata_deserialize (GdkPixdata             *pixdata,
                                         guint                   stream_length,
                                         const guint8           *stream,
                                         GError                **error);
+G_DEPRECATED
 gpointer       gdk_pixdata_from_pixbuf (GdkPixdata             *pixdata,
                                         const GdkPixbuf        *pixbuf,
                                         gboolean                use_rle);
+G_DEPRECATED
 GdkPixbuf*     gdk_pixbuf_from_pixdata (const GdkPixdata       *pixdata,
                                         gboolean                copy_pixels,
                                         GError                **error);
@@ -158,6 +163,7 @@ typedef enum
 } GdkPixdataDumpType;
   
 
+G_DEPRECATED
 GString*       gdk_pixdata_to_csource  (GdkPixdata             *pixdata,
                                         const gchar            *name,
                                         GdkPixdataDumpType      dump_type);
@@ -165,4 +171,6 @@ GString*    gdk_pixdata_to_csource  (GdkPixdata             *pixdata,
 
 G_END_DECLS
 
+#endif /* GDK_PIXBUF_DISABLE_DEPRECATED */
+
 #endif /* __GDK_PIXDATA_H__ */


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