[gimp] app: remove gimp_drawable_replace_buffer()



commit 2074accb60b2591b36cb86cc557da87cab2dd84d
Author: Ell <ell_se yahoo com>
Date:   Thu Feb 14 07:56:54 2019 -0500

    app: remove gimp_drawable_replace_buffer()
    
    Remove gimp_drawable_replace_buffer(), which is no longer used
    anywhere since commits ddb69b77a7610f578f5143af1cdeed2c27d4f3e4 and
    3451ffb62cc3365d13d494586177ca2e1dacd4bf.  This eliminates
    redundancy, since all compositing is now done through the layer-
    mode code.
    
    Furthermore, gimp_drawable_replace_buffer() used the drawable's
    active-component array, whose layout depends on the image mode, as
    an argument to gimp_gegl_replace(), which always expects an RGBA
    component array, resulting in broken component masking in non-RGB
    images.

 app/core/gimpdrawable-combine.c | 133 ----------------------------------------
 app/core/gimpdrawable-combine.h |  36 ++++-------
 app/core/gimpdrawable.c         |  26 --------
 app/core/gimpdrawable.h         |  20 ------
 4 files changed, 13 insertions(+), 202 deletions(-)
---
diff --git a/app/core/gimpdrawable-combine.c b/app/core/gimpdrawable-combine.c
index cc65cae3bc..962fc9d2d9 100644
--- a/app/core/gimpdrawable-combine.c
+++ b/app/core/gimpdrawable-combine.c
@@ -25,16 +25,11 @@
 #include "core-types.h"
 
 #include "gegl/gimpapplicator.h"
-#include "gegl/gimp-babl-compat.h"
-#include "gegl/gimp-gegl-apply-operation.h"
-#include "gegl/gimp-gegl-loops.h"
-#include "gegl/gimp-gegl-utils.h"
 
 #include "gimp.h"
 #include "gimpchannel.h"
 #include "gimpdrawable-combine.h"
 #include "gimpimage.h"
-#include "gimptempbuf.h"
 
 
 void
@@ -135,131 +130,3 @@ gimp_drawable_real_apply_buffer (GimpDrawable           *drawable,
 
   g_object_unref (applicator);
 }
-
-/*  Similar to gimp_drawable_apply_region but works in "replace" mode (i.e.
- *  transparent pixels in src2 make the result transparent rather than
- *  opaque.
- *
- * Takes an additional mask pixel region as well.
- */
-void
-gimp_drawable_real_replace_buffer (GimpDrawable        *drawable,
-                                   GeglBuffer          *buffer,
-                                   const GeglRectangle *buffer_region,
-                                   gboolean             push_undo,
-                                   const gchar         *undo_desc,
-                                   gdouble              opacity,
-                                   GeglBuffer          *mask_buffer,
-                                   const GeglRectangle *mask_buffer_region,
-                                   gint                 dest_x,
-                                   gint                 dest_y)
-{
-  GimpItem        *item             = GIMP_ITEM (drawable);
-  GimpImage       *image            = gimp_item_get_image (item);
-  GimpChannel     *mask             = gimp_image_get_mask (image);
-  GeglBuffer      *drawable_buffer;
-  GeglRectangle    buffer_rect      = *buffer_region;
-  GeglRectangle    mask_buffer_rect = *mask_buffer_region;
-  gint             x, y, width, height;
-  gint             offset_x, offset_y;
-  gboolean         active_components[MAX_CHANNELS];
-
-  /*  don't apply the mask to itself and don't apply an empty mask  */
-  if (GIMP_DRAWABLE (mask) == drawable || gimp_channel_is_empty (mask))
-    mask = NULL;
-
-  /*  configure the active channel array  */
-  gimp_drawable_get_active_components (drawable, active_components);
-
-  /*  get the layer offsets  */
-  gimp_item_get_offset (item, &offset_x, &offset_y);
-
-  /*  make sure the image application coordinates are within drawable bounds  */
-  if (! gimp_rectangle_intersect (dest_x, dest_y,
-                                  buffer_rect.width, buffer_rect.height,
-                                  0, 0,
-                                  gimp_item_get_width  (item),
-                                  gimp_item_get_height (item),
-                                  &x, &y, &width, &height))
-    {
-      return;
-    }
-
-  if (mask)
-    {
-      GimpItem *mask_item = GIMP_ITEM (mask);
-
-      /*  make sure coordinates are in mask bounds ...
-       *  we need to add the layer offset to transform coords
-       *  into the mask coordinate system
-       */
-      if (! gimp_rectangle_intersect (x, y, width, height,
-                                      -offset_x, -offset_y,
-                                      gimp_item_get_width  (mask_item),
-                                      gimp_item_get_height (mask_item),
-                                      &x, &y, &width, &height))
-        {
-          return;
-        }
-    }
-
-  /*  adjust the original regions according to the application
-   *  offset and size
-   */
-  buffer_rect.x           += x - dest_x;
-  buffer_rect.y           += y - dest_y;
-  buffer_rect.width        = width;
-  buffer_rect.height       = height;
-
-  mask_buffer_rect.x      += x - dest_x;
-  mask_buffer_rect.y      += y - dest_y;
-  mask_buffer_rect.width   = width;
-  mask_buffer_rect.height  = height;
-
-  /*  If the calling procedure specified an undo step...  */
-  if (push_undo)
-    gimp_drawable_push_undo (drawable, undo_desc,
-                             NULL, x, y, width, height);
-
-  drawable_buffer = gimp_drawable_get_buffer (drawable);
-
-  if (mask)
-    {
-      GeglBuffer *src_buffer;
-      GeglBuffer *dest_buffer;
-
-      src_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
-
-      dest_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
-                                     gegl_buffer_get_format (src_buffer));
-
-      gimp_gegl_buffer_copy (src_buffer,
-                             GEGL_RECTANGLE (x + offset_x, y + offset_y,
-                                             width, height),
-                             GEGL_ABYSS_NONE,
-                             dest_buffer,
-                             GEGL_RECTANGLE (0, 0, 0, 0));
-
-      gimp_gegl_combine_mask (mask_buffer, &mask_buffer_rect,
-                              dest_buffer, GEGL_RECTANGLE (0, 0, width, height),
-                              1.0);
-
-      gimp_gegl_replace (buffer,          &buffer_rect,
-                         drawable_buffer, GEGL_RECTANGLE (x, y, width, height),
-                         dest_buffer,     GEGL_RECTANGLE (0, 0, width, height),
-                         drawable_buffer, GEGL_RECTANGLE (x, y, width, height),
-                         opacity,
-                         active_components);
-
-      g_object_unref (dest_buffer);
-    }
-  else
-    {
-      gimp_gegl_replace (buffer,          &buffer_rect,
-                         drawable_buffer, GEGL_RECTANGLE (x, y, width, height),
-                         mask_buffer,     &mask_buffer_rect,
-                         drawable_buffer, GEGL_RECTANGLE (x, y, width, height),
-                         opacity,
-                         active_components);
-    }
-}
diff --git a/app/core/gimpdrawable-combine.h b/app/core/gimpdrawable-combine.h
index 6bd0825431..d21d558d32 100644
--- a/app/core/gimpdrawable-combine.h
+++ b/app/core/gimpdrawable-combine.h
@@ -21,29 +21,19 @@
 
 /*  virtual functions of GimpDrawable, don't call directly  */
 
-void   gimp_drawable_real_apply_buffer   (GimpDrawable           *drawable,
-                                          GeglBuffer             *buffer,
-                                          const GeglRectangle    *buffer_region,
-                                          gboolean                push_undo,
-                                          const gchar            *undo_desc,
-                                          gdouble                 opacity,
-                                          GimpLayerMode           mode,
-                                          GimpLayerColorSpace     blend_space,
-                                          GimpLayerColorSpace     composite_space,
-                                          GimpLayerCompositeMode  composite_mode,
-                                          GeglBuffer             *base_buffer,
-                                          gint                    base_x,
-                                          gint                    base_y);
-void   gimp_drawable_real_replace_buffer (GimpDrawable           *drawable,
-                                          GeglBuffer             *buffer,
-                                          const GeglRectangle    *buffer_region,
-                                          gboolean                push_undo,
-                                          const gchar            *undo_desc,
-                                          gdouble                 opacity,
-                                          GeglBuffer             *mask,
-                                          const GeglRectangle    *mask_region,
-                                          gint                    x,
-                                          gint                    y);
+void   gimp_drawable_real_apply_buffer (GimpDrawable           *drawable,
+                                        GeglBuffer             *buffer,
+                                        const GeglRectangle    *buffer_region,
+                                        gboolean                push_undo,
+                                        const gchar            *undo_desc,
+                                        gdouble                 opacity,
+                                        GimpLayerMode           mode,
+                                        GimpLayerColorSpace     blend_space,
+                                        GimpLayerColorSpace     composite_space,
+                                        GimpLayerCompositeMode  composite_mode,
+                                        GeglBuffer             *base_buffer,
+                                        gint                    base_x,
+                                        gint                    base_y);
 
 
 #endif /* __GIMP_DRAWABLE_COMBINE_H__ */
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 13b573c273..b0ac3c8f2a 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -284,7 +284,6 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
   klass->get_active_mask          = NULL;
   klass->convert_type             = gimp_drawable_real_convert_type;
   klass->apply_buffer             = gimp_drawable_real_apply_buffer;
-  klass->replace_buffer           = gimp_drawable_real_replace_buffer;
   klass->get_buffer               = gimp_drawable_real_get_buffer;
   klass->set_buffer               = gimp_drawable_real_set_buffer;
   klass->push_undo                = gimp_drawable_real_push_undo;
@@ -1225,31 +1224,6 @@ gimp_drawable_apply_buffer (GimpDrawable           *drawable,
                                                     base_x, base_y);
 }
 
-void
-gimp_drawable_replace_buffer (GimpDrawable        *drawable,
-                              GeglBuffer          *buffer,
-                              const GeglRectangle *buffer_region,
-                              gboolean             push_undo,
-                              const gchar         *undo_desc,
-                              gdouble              opacity,
-                              GeglBuffer          *mask,
-                              const GeglRectangle *mask_region,
-                              gint                 x,
-                              gint                 y)
-{
-  g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
-  g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
-  g_return_if_fail (GEGL_IS_BUFFER (buffer));
-  g_return_if_fail (GEGL_IS_BUFFER (mask));
-
-  GIMP_DRAWABLE_GET_CLASS (drawable)->replace_buffer (drawable, buffer,
-                                                      buffer_region,
-                                                      push_undo, undo_desc,
-                                                      opacity,
-                                                      mask, mask_region,
-                                                      x, y);
-}
-
 GeglBuffer *
 gimp_drawable_get_buffer (GimpDrawable *drawable)
 {
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index d1a6a12b11..93fa100a26 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -84,16 +84,6 @@ struct _GimpDrawableClass
                                            GeglBuffer           *base_buffer,
                                            gint                  base_x,
                                            gint                  base_y);
-  void          (* replace_buffer)        (GimpDrawable         *drawable,
-                                           GeglBuffer           *buffer,
-                                           const GeglRectangle  *buffer_region,
-                                           gboolean              push_undo,
-                                           const gchar          *undo_desc,
-                                           gdouble               opacity,
-                                           GeglBuffer           *mask,
-                                           const GeglRectangle  *mask_region,
-                                           gint                  x,
-                                           gint                  y);
   GeglBuffer  * (* get_buffer)            (GimpDrawable         *drawable);
   void          (* set_buffer)            (GimpDrawable         *drawable,
                                            gboolean              push_undo,
@@ -168,16 +158,6 @@ void            gimp_drawable_apply_buffer       (GimpDrawable        *drawable,
                                                   GeglBuffer          *base_buffer,
                                                   gint                 base_x,
                                                   gint                 base_y);
-void            gimp_drawable_replace_buffer     (GimpDrawable        *drawable,
-                                                  GeglBuffer          *buffer,
-                                                  const GeglRectangle *buffer_region,
-                                                  gboolean             push_undo,
-                                                  const gchar         *undo_desc,
-                                                  gdouble              opacity,
-                                                  GeglBuffer          *mask,
-                                                  const GeglRectangle *mask_region,
-                                                  gint                 x,
-                                                  gint                 y);
 
 GeglBuffer    * gimp_drawable_get_buffer         (GimpDrawable       *drawable);
 void            gimp_drawable_set_buffer         (GimpDrawable       *drawable,


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