]> Pileus Git - ~andy/gtk/blobdiff - gdk-pixbuf/io-png.c
Fix a bug with checking the private flag on the wrong window; improve the
[~andy/gtk] / gdk-pixbuf / io-png.c
index 9081096e7dfa6c01bac42f477f3545cc43f2fdf2..5ddca7510836aa1b5dad842af4a0a8a24827d89e 100644 (file)
@@ -358,8 +358,8 @@ struct _LoadContext {
         png_structp png_read_ptr;
         png_infop   png_info_ptr;
 
-        ModulePreparedNotifyFunc prepare_func;
-        ModuleUpdatedNotifyFunc update_func;
+        GdkPixbufModulePreparedFunc prepare_func;
+        GdkPixbufModuleUpdatedFunc update_func;
         gpointer notify_user_data;
 
         GdkPixbuf* pixbuf;
@@ -386,8 +386,9 @@ struct _LoadContext {
 };
 
 static gpointer
-gdk_pixbuf__png_image_begin_load (ModulePreparedNotifyFunc prepare_func,
-                                 ModuleUpdatedNotifyFunc update_func,
+gdk_pixbuf__png_image_begin_load (GdkPixbufModuleSizeFunc size_func,
+                                  GdkPixbufModulePreparedFunc prepare_func,
+                                 GdkPixbufModuleUpdatedFunc update_func,
                                  gpointer user_data,
                                   GError **error)
 {
@@ -876,7 +877,7 @@ gdk_pixbuf__png_image_save (FILE          *f,
        png_write_end (png_ptr, info_ptr);
 
 cleanup:
-       png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
+       png_destroy_write_struct (&png_ptr, &info_ptr);
 
        if (num_keys > 0) {
                for (i = 0; i < num_keys; i++)
@@ -887,14 +888,36 @@ cleanup:
        return success;
 }
 
-
+void
+MODULE_ENTRY (png, fill_vtable) (GdkPixbufModule *module)
+{
+        module->load = gdk_pixbuf__png_image_load;
+        module->begin_load = gdk_pixbuf__png_image_begin_load;
+        module->stop_load = gdk_pixbuf__png_image_stop_load;
+        module->load_increment = gdk_pixbuf__png_image_load_increment;
+        module->save = gdk_pixbuf__png_image_save;
+}
 
 void
-gdk_pixbuf__png_fill_vtable (GdkPixbufModule *module)
+MODULE_ENTRY (png, fill_info) (GdkPixbufFormat *info)
 {
-  module->load = gdk_pixbuf__png_image_load;
-  module->begin_load = gdk_pixbuf__png_image_begin_load;
-  module->stop_load = gdk_pixbuf__png_image_stop_load;
-  module->load_increment = gdk_pixbuf__png_image_load_increment;
-  module->save = gdk_pixbuf__png_image_save;
+        static GdkPixbufModulePattern signature[] = {
+                { "\x89PNG\r\n\x1a\x0a", NULL, 100 },
+                { NULL, NULL, 0 }
+        };
+       static gchar * mime_types[] = {
+               "image/png",
+               NULL
+       };
+       static gchar * extensions[] = {
+               "png",
+               NULL
+       };
+
+       info->name = "png";
+        info->signature = signature;
+       info->description = N_("The PNG image format");
+       info->mime_types = mime_types;
+       info->extensions = extensions;
+       info->flags = GDK_PIXBUF_FORMAT_WRITABLE;
 }