[gimp/goat-invasion: 550/608] app: enable blur/sharpen via GimpConvolve on indexed drawables



commit 41add352e16974e3e0005430ea6c0358d312f294
Author: Michael Natterer <mitch gimp org>
Date:   Mon Apr 23 00:13:36 2012 +0200

    app: enable blur/sharpen via GimpConvolve on indexed drawables

 app/gegl/gimp-gegl-loops.c |   24 +++++++++++++++++++++---
 app/paint/gimpconvolve.c   |    3 ---
 2 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-loops.c b/app/gegl/gimp-gegl-loops.c
index cf74802..7c8243b 100644
--- a/app/gegl/gimp-gegl-loops.c
+++ b/app/gegl/gimp-gegl-loops.c
@@ -26,6 +26,7 @@
 
 #include "gimp-gegl-types.h"
 
+#include "gimp-babl.h"
 #include "gimp-gegl-loops.h"
 
 
@@ -48,17 +49,34 @@ gimp_gegl_convolve (GeglBuffer          *src_buffer,
   gint                src_bpp;
   gint                dest_bpp;
 
-  src_format  = gegl_buffer_get_format (src_buffer);
+  src_format = gegl_buffer_get_format (src_buffer);
+
+  if (babl_format_is_palette (src_format))
+    src_format = gimp_babl_format (GIMP_RGB, GIMP_PRECISION_U8,
+                                   babl_format_has_alpha (src_format));
+  else
+    src_format = gimp_babl_format (gimp_babl_format_get_base_type (src_format),
+                                   GIMP_PRECISION_U8,
+                                   babl_format_has_alpha (src_format));
+
   dest_format = gegl_buffer_get_format (dest_buffer);
 
+  if (babl_format_is_palette (dest_format))
+    dest_format = gimp_babl_format (GIMP_RGB, GIMP_PRECISION_U8,
+                                    babl_format_has_alpha (dest_format));
+  else
+    dest_format = gimp_babl_format (gimp_babl_format_get_base_type (dest_format),
+                                    GIMP_PRECISION_U8,
+                                    babl_format_has_alpha (dest_format));
+
   src_bpp  = babl_format_get_bytes_per_pixel (src_format);
   dest_bpp = babl_format_get_bytes_per_pixel (dest_format);
 
-  iter = gegl_buffer_iterator_new (src_buffer, src_rect, 0, NULL,
+  iter = gegl_buffer_iterator_new (src_buffer, src_rect, 0, src_format,
                                    GEGL_BUFFER_READ, GEGL_ABYSS_NONE);
   src_roi = &iter->roi[0];
 
-  gegl_buffer_iterator_add (iter, dest_buffer, dest_rect, 0, NULL,
+  gegl_buffer_iterator_add (iter, dest_buffer, dest_rect, 0, dest_format,
                             GEGL_BUFFER_WRITE, GEGL_ABYSS_NONE);
   dest_roi = &iter->roi[1];
 
diff --git a/app/paint/gimpconvolve.c b/app/paint/gimpconvolve.c
index c7f1a83..a750e6f 100644
--- a/app/paint/gimpconvolve.c
+++ b/app/paint/gimpconvolve.c
@@ -141,9 +141,6 @@ gimp_convolve_motion (GimpPaintCore    *paint_core,
   gdouble              opacity;
   gdouble              rate;
 
-  if (gimp_drawable_is_indexed (drawable))
-    return;
-
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
   opacity_output = gimp_dynamics_get_output (dynamics,



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