[gimp] plug-ins: port file-wmf to GEGL
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: port file-wmf to GEGL
- Date: Fri, 30 Aug 2013 21:13:23 +0000 (UTC)
commit c4764a5090dd9df0180a73dc130e6e931db9a03c
Author: Michael Natterer <mitch gimp org>
Date: Fri Aug 30 23:11:48 2013 +0200
plug-ins: port file-wmf to GEGL
plug-ins/common/Makefile.am | 1 +
plug-ins/common/file-wmf.c | 45 +++++++--------------------------------
plug-ins/common/plugin-defs.pl | 2 +-
3 files changed, 10 insertions(+), 38 deletions(-)
---
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 2e38dc1..3c3e19b 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -1441,6 +1441,7 @@ file_wmf_LDADD = \
$(libgimpcolor) \
$(libgimpbase) \
$(GTK_LIBS) \
+ $(GEGL_LIBS) \
$(WMF_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
diff --git a/plug-ins/common/file-wmf.c b/plug-ins/common/file-wmf.c
index 31ef005..e376317 100644
--- a/plug-ins/common/file-wmf.c
+++ b/plug-ins/common/file-wmf.c
@@ -174,6 +174,7 @@ run (const gchar *name,
gint height = 0;
INIT_I18N ();
+ gegl_init (NULL, NULL);
run_mode = param[0].data.d_int32;
@@ -975,22 +976,15 @@ load_image (const gchar *filename,
{
gint32 image;
gint32 layer;
- GimpDrawable *drawable;
+ GeglBuffer *buffer;
guchar *pixels;
- GimpPixelRgn pixel_rgn;
guint width, height;
- guint rowstride;
- guint count = 0;
- guint done = 0;
- gpointer pr;
pixels = wmf_load_file (filename, &width, &height, error);
if (! pixels)
return -1;
- rowstride = width * 4;
-
gimp_progress_init_printf (_("Opening '%s'"),
gimp_filename_to_utf8 (filename));
@@ -1004,42 +998,19 @@ load_image (const gchar *filename,
width, height,
GIMP_RGBA_IMAGE, 100, GIMP_NORMAL_MODE);
- drawable = gimp_drawable_get (layer);
-
- gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, width, height, TRUE, FALSE);
-
- for (pr = gimp_pixel_rgns_register (1, &pixel_rgn);
- pr != NULL;
- pr = gimp_pixel_rgns_process (pr))
- {
- const guchar *src = pixels + pixel_rgn.y * rowstride + pixel_rgn.x * 4;
- guchar *dest = pixel_rgn.data;
- gint y;
-
- for (y = 0; y < pixel_rgn.h; y++)
- {
- memcpy (dest, src, pixel_rgn.w * pixel_rgn.bpp);
-
- src += rowstride;
- dest += pixel_rgn.rowstride;
- }
+ buffer = gimp_drawable_get_buffer (layer);
- done += pixel_rgn.h * pixel_rgn.w;
+ gegl_buffer_set (buffer, GEGL_RECTANGLE (0, 0, width, height), 0,
+ babl_format ("R'G'B'A u8"),
+ pixels, GEGL_AUTO_ROWSTRIDE);
- if (count++ % 16 == 0)
- gimp_progress_update ((gdouble) done / (width * height));
- }
+ g_object_unref (buffer);
g_free (pixels);
- gimp_drawable_detach (drawable);
+ gimp_image_insert_layer (image, layer, -1, 0);
gimp_progress_update (1.0);
- /* Tell GIMP to display the image.
- */
- gimp_image_insert_layer (image, layer, -1, 0);
- gimp_drawable_flush (drawable);
-
return image;
}
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 1cf4f10..09d8f96 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -69,7 +69,7 @@
'file-tga' => { ui => 1, gegl => 1 },
'file-tiff-load' => { ui => 1, gegl => 1, optional => 1, libs => 'TIFF_LIBS' },
'file-tiff-save' => { ui => 1, gegl => 1, optional => 1, libs => 'TIFF_LIBS' },
- 'file-wmf' => { ui => 1, optional => 1, libs => 'WMF_LIBS', cflags => 'WMF_CFLAGS' },
+ 'file-wmf' => { ui => 1, gegl => 1, optional => 1, libs => 'WMF_LIBS', cflags => 'WMF_CFLAGS' },
'file-xbm' => { ui => 1, gegl => 1 },
'file-xmc' => { ui => 1, optional => 1, libs => 'XMC_LIBS' },
'file-xpm' => { ui => 1, gegl => 1, optional => 1, libs => 'XPM_LIBS' },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]