[gimp] plug-ins: port file-wmf to libgimp objects.



commit 2211e4eb0ed1855b7ae034bf8ada1007ac1c0ece
Author: Jehan <jehan girinstud io>
Date:   Thu Aug 22 23:11:03 2019 +0200

    plug-ins: port file-wmf to libgimp objects.

 plug-ins/common/Makefile.am    |  2 --
 plug-ins/common/file-wmf.c     | 28 ++++++++++++++--------------
 plug-ins/common/plugin-defs.pl |  2 +-
 3 files changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 83c076940f..5b8802cba4 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -1156,8 +1156,6 @@ file_tga_LDADD = \
 
 file_wmf_CFLAGS = $(WMF_CFLAGS)
 
-file_wmf_CPPFLAGS = $(AM_CPPFLAGS) -DGIMP_DEPRECATED_REPLACE_NEW_API
-
 file_wmf_SOURCES = \
        file-wmf.c
 
diff --git a/plug-ins/common/file-wmf.c b/plug-ins/common/file-wmf.c
index b35e6178ad..4062567952 100644
--- a/plug-ins/common/file-wmf.c
+++ b/plug-ins/common/file-wmf.c
@@ -84,7 +84,7 @@ static GimpValueArray * wmf_load_thumb       (GimpProcedure        *procedure,
                                               const GimpValueArray *args,
                                               gpointer              run_data);
 
-static gint32           load_image           (const gchar          *filename,
+static GimpImage      * load_image           (const gchar          *filename,
                                               GError              **error);
 static gboolean         load_wmf_size        (const gchar          *filename,
                                               WmfLoadVals          *vals);
@@ -216,7 +216,7 @@ wmf_load (GimpProcedure        *procedure,
 {
   GimpValueArray *return_vals;
   gchar          *filename;
-  gint32          image;
+  GimpImage      *image;
   GError         *error = NULL;
 
   INIT_I18N ();
@@ -249,7 +249,7 @@ wmf_load (GimpProcedure        *procedure,
 
   g_free (filename);
 
-  if (image < 1)
+  if (! image)
     return gimp_procedure_new_return_values (procedure,
                                              GIMP_PDB_EXECUTION_ERROR,
                                              error);
@@ -272,9 +272,9 @@ wmf_load_thumb (GimpProcedure        *procedure,
 {
   GimpValueArray *return_vals;
   gchar          *filename;
+  GimpImage      *image;
   gint            width;
   gint            height;
-  gint32          image;
   GError         *error = NULL;
 
   INIT_I18N ();
@@ -311,7 +311,7 @@ wmf_load_thumb (GimpProcedure        *procedure,
 
   g_free (filename);
 
-  if (image < 1)
+  if (! image)
     return gimp_procedure_new_return_values (procedure,
                                              GIMP_PDB_EXECUTION_ERROR,
                                              error);
@@ -1018,15 +1018,15 @@ wmf_load_file (const gchar  *filename,
 /*
  * 'load_image()' - Load a WMF image into a new image window.
  */
-static gint32
+static GimpImage *
 load_image (const gchar  *filename,
             GError      **error)
 {
-  gint32        image;
-  gint32        layer;
-  GeglBuffer   *buffer;
-  guchar       *pixels;
-  guint         width, height;
+  GimpImage   *image;
+  GimpLayer   *layer;
+  GeglBuffer  *buffer;
+  guchar      *pixels;
+  guint        width, height;
 
   gimp_progress_init_printf (_("Opening '%s'"),
                              gimp_filename_to_utf8 (filename));
@@ -1034,7 +1034,7 @@ load_image (const gchar  *filename,
   pixels = wmf_load_file (filename, &width, &height, error);
 
   if (! pixels)
-    return -1;
+    return NULL;
 
   image = gimp_image_new (width, height, GIMP_RGB);
   gimp_image_set_filename (image, filename);
@@ -1048,7 +1048,7 @@ load_image (const gchar  *filename,
                           100,
                           gimp_image_get_default_new_layer_mode (image));
 
-  buffer = gimp_drawable_get_buffer (layer);
+  buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
 
   gegl_buffer_set (buffer, GEGL_RECTANGLE (0, 0, width, height), 0,
                    babl_format ("R'G'B'A u8"),
@@ -1058,7 +1058,7 @@ load_image (const gchar  *filename,
 
   g_free (pixels);
 
-  gimp_image_insert_layer (image, layer, -1, 0);
+  gimp_image_insert_layer (image, layer, NULL, 0);
 
   gimp_progress_update (1.0);
 
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index bfc43208b9..71c7c93beb 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -46,7 +46,7 @@
     'file-sunras' => { ui => 1, gegl => 1, old_api => 1 },
     'file-svg' => { ui => 1, gegl => 1, libs => 'SVG_LIBS', cflags => 'SVG_CFLAGS', old_api => 1 },
     'file-tga' => { ui => 1, gegl => 1, old_api => 1 },
-    'file-wmf' => { ui => 1, gegl => 1, optional => 1, libs => 'WMF_LIBS', cflags => 'WMF_CFLAGS', old_api 
=> 1 },
+    'file-wmf' => { ui => 1, gegl => 1, optional => 1, libs => 'WMF_LIBS', cflags => 'WMF_CFLAGS' },
     'file-xbm' => { ui => 1, gegl => 1, old_api => 1 },
     'file-xmc' => { ui => 1, gegl => 1, optional => 1, libs => 'XMC_LIBS' },
     'file-xpm' => { ui => 1, gegl => 1, optional => 1, libs => 'XPM_LIBS', old_api => 1 },


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