]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
gdk-pixbuf-2.0: Change ownership of Pixbuf.from_data.data
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Fri, 25 May 2012 06:35:26 +0000 (23:35 -0700)
committerEvan Nemerson <evan@coeus-group.com>
Fri, 25 May 2012 17:53:38 +0000 (10:53 -0700)
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
vapi/metadata/GdkPixbuf-2.0-custom.vala
vapi/metadata/GdkPixbuf-2.0.metadata

index 0a0eaacca0c15c897ab2936452359496dbaa85d1..ee919cdf0e41727bcf0c3bcb0b2d2cdc0881e00e 100644 (file)
@@ -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; }
index b9061e0d8368d763387a5c48b3983f20360e2efa..30c84a319cc72a39addc441148506f6574164ced 100644 (file)
@@ -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
+}
index e7cf2f50dd35b70f1e8ebcba99c2e32364aff2c4..3d4e7238315a2b7723e34026db3a449c657edb4f 100644 (file)
@@ -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