[gimp] plug-ins: port file-gif-load to GEGL



commit 59418b8a21cb02379b3a3c77b6630aa5aa708858
Author: Michael Natterer <mitch gimp org>
Date:   Sat Sep 15 22:08:20 2012 +0200

    plug-ins: port file-gif-load to GEGL

 plug-ins/common/Makefile.am     |    1 +
 plug-ins/common/file-gif-load.c |   21 ++++++++++-----------
 plug-ins/common/plugin-defs.pl  |    2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 1574d8a..9d4b32f 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -1118,6 +1118,7 @@ file_gif_load_LDADD = \
 	$(libgimpbase)		\
 	$(CAIRO_LIBS)		\
 	$(GDK_PIXBUF_LIBS)	\
+	$(GEGL_LIBS)		\
 	$(RT_LIBS)		\
 	$(INTLLIBS)		\
 	$(file_gif_load_RC)
diff --git a/plug-ins/common/file-gif-load.c b/plug-ins/common/file-gif-load.c
index 0bb9bc4..594da3a 100644
--- a/plug-ins/common/file-gif-load.c
+++ b/plug-ins/common/file-gif-load.c
@@ -189,6 +189,8 @@ run (const gchar      *name,
 
   INIT_I18N ();
 
+  gegl_init (NULL, NULL);
+
   *nreturn_vals = 1;
   *return_vals  = values;
 
@@ -883,8 +885,7 @@ ReadImage (FILE        *fd,
   static gint   frame_number = 1;
 
   gint32        layer_ID;
-  GimpPixelRgn  pixel_rgn;
-  GimpDrawable *drawable;
+  GeglBuffer   *buffer;
   guchar       *dest, *temp;
   guchar        c;
   gint          xpos = 0, ypos = 0, pass = 0;
@@ -1052,8 +1053,6 @@ ReadImage (FILE        *fd,
   gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
   gimp_layer_translate (layer_ID, (gint) leftpos, (gint) toppos);
 
-  drawable = gimp_drawable_get (layer_ID);
-
   cur_progress = 0;
   max_progress = height;
 
@@ -1175,16 +1174,16 @@ ReadImage (FILE        *fd,
   if (LZWReadByte (fd, FALSE, c) >= 0)
     g_print ("GIF: too much input data, ignoring extra...\n");
 
-  gimp_progress_update (1.0);
-  gimp_pixel_rgn_init (&pixel_rgn, drawable,
-                       0, 0, drawable->width, drawable->height, TRUE, FALSE);
-  gimp_pixel_rgn_set_rect (&pixel_rgn, dest,
-                           0, 0, drawable->width, drawable->height);
+  buffer = gimp_drawable_get_buffer (layer_ID);
+
+  gegl_buffer_set (buffer, GEGL_RECTANGLE (0, 0, len, height), 0,
+                   NULL, dest, GEGL_AUTO_ROWSTRIDE);
 
   g_free (dest);
 
-  gimp_drawable_flush (drawable);
-  gimp_drawable_detach (drawable);
+  g_object_unref (buffer);
+
+  gimp_progress_update (1.0);
 
   return image_ID;
 }
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 5049fe9..6e719b0 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -52,7 +52,7 @@
     'file-dicom' => { ui => 1, cflags => '-fno-strict-aliasing' },
     'file-gbr' => { ui => 1, gegl => 1 },
     'file-gegl' => { ui => 1, gegl => 1 },
-    'file-gif-load' => {},
+    'file-gif-load' => { gegl => 1 },
     'file-gif-save' => { ui => 1 },
     'file-gih' => { ui => 1 },
     'file-glob' => {},



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