[vala] gdk-pixbuf-2.0: Change ownership of Pixbuf.from_data.data



commit de4fd9683767b754cd77e4cf4df0c84c67ddbade
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu May 24 23:35:26 2012 -0700

    gdk-pixbuf-2.0: Change ownership of Pixbuf.from_data.data
    
    This also adds a Pixbuf.take_data which behaves like the old version.
    This can be helpful for avoiding unnecessary copies, but is easy to
    get wrong.
    
    Thanks to Patryk Zawadzki <patrys pld-linux org> for help in finding
    this issue out. Fixes bug 676695.

 vapi/gdk-pixbuf-2.0.vapi                |    4 +++-
 vapi/metadata/GdkPixbuf-2.0-custom.vala |    6 +++++-
 vapi/metadata/GdkPixbuf-2.0.metadata    |    3 +--
 3 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/vapi/gdk-pixbuf-2.0.vapi b/vapi/gdk-pixbuf-2.0.vapi
index 0a0eaac..ee919cd 100644
--- a/vapi/gdk-pixbuf-2.0.vapi
+++ b/vapi/gdk-pixbuf-2.0.vapi
@@ -16,7 +16,7 @@ namespace Gdk {
 		public void fill (uint32 pixel);
 		public Gdk.Pixbuf? flip (bool horizontal);
 		[CCode (has_construct_function = false)]
-		public Pixbuf.from_data ([CCode (array_length = false)] uint8[] data, Gdk.Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height, int rowstride, Gdk.PixbufDestroyNotify? destroy_fn);
+		public Pixbuf.from_data ([CCode (array_length = false)] owned uint8[] data, Gdk.Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height, int rowstride, [CCode (type = "GdkPixbufDestroyNotify")] Gdk.PixbufDestroyNotify? destroy_fn = GLib.free);
 		[CCode (has_construct_function = false)]
 		public Pixbuf.from_file (string filename) throws GLib.Error;
 		[CCode (has_construct_function = false)]
@@ -67,6 +67,8 @@ namespace Gdk {
 		public Gdk.Pixbuf scale_simple (int dest_width, int dest_height, Gdk.InterpType interp_type);
 		[CCode (has_construct_function = false)]
 		public Pixbuf.subpixbuf (Gdk.Pixbuf src_pixbuf, int src_x, int src_y, int width, int height);
+		[CCode (cname = "gdk_pixbuf_new_from_data", has_construct_function = false)]
+		public Pixbuf.take_data ([CCode (array_length = false)] uint8[] data, Gdk.Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height, int rowstride, [CCode (type = "GdkPixbufDestroyNotify")] Gdk.PixbufDestroyNotify? destroy_fn = null);
 		public int bits_per_sample { get; construct; }
 		public Gdk.Colorspace colorspace { get; construct; }
 		public bool has_alpha { get; construct; }
diff --git a/vapi/metadata/GdkPixbuf-2.0-custom.vala b/vapi/metadata/GdkPixbuf-2.0-custom.vala
index b9061e0..30c84a3 100644
--- a/vapi/metadata/GdkPixbuf-2.0-custom.vala
+++ b/vapi/metadata/GdkPixbuf-2.0-custom.vala
@@ -1,5 +1,9 @@
 namespace Gdk {
 	public class Pixbuf : GLib.Object {
+		[CCode (has_construct_function = false)]
+		public Pixbuf.from_data ([CCode (array_length = false)] owned uint8[] data, Gdk.Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height, int rowstride, [CCode (type = "GdkPixbufDestroyNotify")] Gdk.PixbufDestroyNotify? destroy_fn = GLib.free);
+		[CCode (has_construct_function = false, cname = "gdk_pixbuf_new_from_data")]
+		public Pixbuf.take_data ([CCode (array_length = false)] uint8[] data, Gdk.Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height, int rowstride, [CCode (type = "GdkPixbufDestroyNotify")] Gdk.PixbufDestroyNotify? destroy_fn = null);
 		[CCode (cname = "gdk_pixbuf_new_from_stream_async", finish_name = "gdk_pixbuf_new_from_stream_finish")]
 		public static async Gdk.Pixbuf new_from_stream_async (GLib.InputStream stream, GLib.Cancellable? cancellable = null) throws GLib.Error;
 		[CCode (cname = "gdk_pixbuf_new_from_stream_at_scale_async", finish_name = "gdk_pixbuf_new_from_stream_finish")]
@@ -19,4 +23,4 @@ namespace Gdk {
 	public delegate void PixbufDestroyNotify ([CCode (array_length = false)] uint8[] pixels);
 	[CCode (cheader_filename = "gdk-pixbuf/gdk-pixdata.h", instance_pos = -0.9)]
 	public delegate bool PixbufSaveFunc ([CCode (array_length_type = "gsize")] uint8[] buf) throws GLib.Error;
-}
\ No newline at end of file
+}
diff --git a/vapi/metadata/GdkPixbuf-2.0.metadata b/vapi/metadata/GdkPixbuf-2.0.metadata
index e7cf2f5..3d4e723 100644
--- a/vapi/metadata/GdkPixbuf-2.0.metadata
+++ b/vapi/metadata/GdkPixbuf-2.0.metadata
@@ -5,7 +5,7 @@ Pixbuf
         .flip nullable
         .from_pixdata cheader_filename="gdk-pixbuf/gdk-pixdata.h"
         .from_pixdata.copy_pixels default=true
-        .new_from_data.data type="uint8[]"
+        .new_from_data skip
         .new_from_inline.copy_pixels default=true
         .new_from_stream_async skip
         .new_from_stream_finish skip
@@ -21,7 +21,6 @@ PixbufSaveFunc skip
 
 // Upstream
 Pixbuf
-        .new_from_data.destroy_fn nullable
         .new_from_inline.data type="uint8[]" array_length_idx=0
         .get_file_info unowned
         .get_file_info.width out



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