[gimp/wip/Jehan/classy-GIMP: 36/50] plug-ins: port file-exr to GimpImage/GimpDrawable.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/Jehan/classy-GIMP: 36/50] plug-ins: port file-exr to GimpImage/GimpDrawable.
- Date: Thu, 22 Aug 2019 13:31:22 +0000 (UTC)
commit 445f4aedff17bc4e8f2687f87fcdeaa95e62d0c3
Author: Jehan <jehan girinstud io>
Date: Fri Aug 16 00:54:34 2019 +0200
plug-ins: port file-exr to GimpImage/GimpDrawable.
plug-ins/file-exr/Makefile.am | 1 -
plug-ins/file-exr/file-exr.c | 32 ++++++++++++++++----------------
2 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/plug-ins/file-exr/Makefile.am b/plug-ins/file-exr/Makefile.am
index 9d5e1f66b5..5ad2b56659 100644
--- a/plug-ins/file-exr/Makefile.am
+++ b/plug-ins/file-exr/Makefile.am
@@ -22,7 +22,6 @@ AM_LDFLAGS = $(mwindows)
libexecdir = $(gimpplugindir)/plug-ins/file-exr
AM_CPPFLAGS = \
- -DGIMP_DEPRECATED_REPLACE_NEW_API \
-I$(top_srcdir) \
$(GTK_CFLAGS) \
$(GEGL_CFLAGS) \
diff --git a/plug-ins/file-exr/file-exr.c b/plug-ins/file-exr/file-exr.c
index 326eb733d8..5cc5665d9a 100644
--- a/plug-ins/file-exr/file-exr.c
+++ b/plug-ins/file-exr/file-exr.c
@@ -58,7 +58,7 @@ static GimpValueArray * exr_load (GimpProcedure *procedure,
const GimpValueArray *args,
gpointer run_data);
-static gint32 load_image (const gchar *filename,
+static GimpImage * load_image (const gchar *filename,
gboolean interactive,
GError **error);
static void sanitize_comment (gchar *comment);
@@ -132,17 +132,17 @@ exr_load (GimpProcedure *procedure,
gpointer run_data)
{
GimpValueArray *return_vals;
- gint32 image_ID;
+ GimpImage *image;
GError *error = NULL;
INIT_I18N ();
gegl_init (NULL, NULL);
- image_ID = load_image (g_file_get_path (file),
- run_mode == GIMP_RUN_INTERACTIVE,
- &error);
+ image = load_image (g_file_get_path (file),
+ run_mode == GIMP_RUN_INTERACTIVE,
+ &error);
- if (image_ID < 1)
+ if (! image)
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
error);
@@ -151,12 +151,12 @@ exr_load (GimpProcedure *procedure,
GIMP_PDB_SUCCESS,
NULL);
- GIMP_VALUES_SET_IMAGE (return_vals, 1, image_ID);
+ GIMP_VALUES_SET_IMAGE (return_vals, 1, image);
return return_vals;
}
-static gint32
+static GimpImage *
load_image (const gchar *filename,
gboolean interactive,
GError **error)
@@ -167,9 +167,9 @@ load_image (const gchar *filename,
gboolean has_alpha;
GimpImageBaseType image_type;
GimpPrecision image_precision;
- gint32 image = -1;
+ GimpImage *image = NULL;
GimpImageType layer_type;
- gint32 layer;
+ GimpLayer *layer;
const Babl *format;
GeglBuffer *buffer = NULL;
gint bpp;
@@ -247,7 +247,7 @@ load_image (const gchar *filename,
image = gimp_image_new_with_precision (width, height,
image_type, image_precision);
- if (image == -1)
+ if (! image)
{
g_set_error (error, 0, 0,
_("Could not create new image for '%s': %s"),
@@ -272,10 +272,10 @@ load_image (const gchar *filename,
layer = gimp_layer_new (image, _("Background"), width, height,
layer_type, 100,
gimp_image_get_default_new_layer_mode (image));
- gimp_image_insert_layer (image, layer, -1, 0);
+ gimp_image_insert_layer (image, layer, NULL, 0);
- buffer = gimp_drawable_get_buffer (layer);
- format = gimp_drawable_get_format (layer);
+ buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
+ format = gimp_drawable_get_format (GIMP_DRAWABLE (layer));
bpp = babl_format_get_bytes_per_pixel (format);
tile_height = gimp_tile_height ();
@@ -373,10 +373,10 @@ load_image (const gchar *filename,
if (success)
return image;
- if (image != -1)
+ if (image)
gimp_image_delete (image);
- return -1;
+ return NULL;
}
/* copy & pasted from file-jpeg/jpeg-load.c */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]