[gimp/metadata-browser] app: use GEGL to invert channels/selections



commit 8843313ad7bbca6f6e9117bb899ee2b4258e45ea
Author: Michael Natterer <mitch gimp org>
Date:   Wed Mar 14 12:31:28 2012 +0100

    app: use GEGL to invert channels/selections

 app/core/gimpchannel.c |   26 +++++++++++---------------
 1 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 2d97f76..247219c 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -51,6 +51,7 @@
 #include "gimpchannel-project.h"
 #include "gimpchannel-select.h"
 #include "gimpcontext.h"
+#include "gimpdrawable-operation.h"
 #include "gimpdrawable-stroke.h"
 #include "gimpmarshal.h"
 #include "gimppaintinfo.h"
@@ -1396,11 +1397,13 @@ static void
 gimp_channel_real_invert (GimpChannel *channel,
                           gboolean     push_undo)
 {
+  GimpDrawable *drawable = GIMP_DRAWABLE (channel);
+
   if (push_undo)
     gimp_channel_push_undo (channel,
                             GIMP_CHANNEL_GET_CLASS (channel)->invert_desc);
   else
-    gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (channel));
+    gimp_drawable_invalidate_boundary (drawable);
 
   if (channel->bounds_known && channel->empty)
     {
@@ -1408,22 +1411,15 @@ gimp_channel_real_invert (GimpChannel *channel,
     }
   else
     {
-      PixelRegion  maskPR;
-      GimpLut     *lut;
-
-      pixel_region_init (&maskPR,
-                         gimp_drawable_get_tiles (GIMP_DRAWABLE (channel)),
-                         0, 0,
-                         gimp_item_get_width  (GIMP_ITEM (channel)),
-                         gimp_item_get_height (GIMP_ITEM (channel)), TRUE);
-
-      lut = invert_lut_new (1);
+      GeglNode *node = g_object_new (GEGL_TYPE_NODE,
+                                     "operation", "gegl:invert",
+                                     NULL);
 
-      pixel_regions_process_parallel ((PixelProcessorFunc)
-                                      gimp_lut_process_inline,
-                                      lut, 1, &maskPR);
+      gimp_drawable_apply_operation_to_tiles (drawable, NULL, NULL,
+                                              node, TRUE,
+                                              gimp_drawable_get_tiles (drawable));
 
-      gimp_lut_free (lut);
+      g_object_unref (node);
 
       channel->bounds_known = FALSE;
 



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