[gimp/goat-invasion: 565/608] app: uncruftify combine_regions_replace() a bit to ease porting



commit 311a2f831fab2d91b9527483b9af247a18bf9387
Author: Michael Natterer <mitch gimp org>
Date:   Mon Apr 23 22:38:44 2012 +0200

    app: uncruftify combine_regions_replace() a bit to ease porting

 app/core/gimpdrawable-combine.c |   22 ++++------------------
 app/paint-funcs/paint-funcs.c   |   39 +++------------------------------------
 app/paint-funcs/paint-funcs.h   |    4 +---
 3 files changed, 8 insertions(+), 57 deletions(-)
---
diff --git a/app/core/gimpdrawable-combine.c b/app/core/gimpdrawable-combine.c
index 6f26896..48e7961 100644
--- a/app/core/gimpdrawable-combine.c
+++ b/app/core/gimpdrawable-combine.c
@@ -266,7 +266,6 @@ gimp_drawable_real_replace_buffer (GimpDrawable        *drawable,
   gint             x, y, width, height;
   gint             offset_x, offset_y;
   PixelRegion      src1PR, destPR;
-  CombinationMode  operation;
   gboolean         active_components[MAX_CHANNELS];
 
   temp_buf = gimp_gegl_buffer_get_temp_buf (buffer);
@@ -312,17 +311,6 @@ gimp_drawable_real_replace_buffer (GimpDrawable        *drawable,
   /*  configure the active channel array  */
   gimp_drawable_get_active_components (drawable, active_components);
 
-  /*  determine what sort of operation is being attempted and
-   *  if it's actually legal...
-   */
-  operation = gimp_image_get_combination_mode (gimp_drawable_type (drawable),
-                                               src2PR.bytes);
-  if (operation == -1)
-    {
-      g_warning ("%s: illegal parameters.", G_STRFUNC);
-      return;
-    }
-
   /*  get the layer offsets  */
   gimp_item_get_offset (item, &offset_x, &offset_y);
 
@@ -392,18 +380,16 @@ gimp_drawable_real_replace_buffer (GimpDrawable        *drawable,
 
       pixel_region_init_temp_buf (&tempPR, temp_buf, 0, 0, width, height);
 
-      combine_regions_replace (&src1PR, &src2PR, &destPR, &tempPR, NULL,
+      combine_regions_replace (&src1PR, &src2PR, &destPR, &tempPR,
                                opacity * 255.999,
-                               active_components,
-                               operation);
+                               active_components);
 
       gimp_temp_buf_unref (temp_buf);
     }
   else
     {
-      combine_regions_replace (&src1PR, &src2PR, &destPR, &maskPR, NULL,
+      combine_regions_replace (&src1PR, &src2PR, &destPR, &maskPR,
                                opacity * 255.999,
-                               active_components,
-                               operation);
+                               active_components);
     }
 }
diff --git a/app/paint-funcs/paint-funcs.c b/app/paint-funcs/paint-funcs.c
index 88bb933..6d03bdc 100644
--- a/app/paint-funcs/paint-funcs.c
+++ b/app/paint-funcs/paint-funcs.c
@@ -96,18 +96,6 @@ static const guchar  no_mask = OPAQUE_OPACITY;
 
 /*  Local function prototypes  */
 
-static void     apply_layer_mode_replace (const guchar   *src1,
-                                          const guchar   *src2,
-                                          guchar         *dest,
-                                          const guchar   *mask,
-                                          gint            x,
-                                          gint            y,
-                                          guint           opacity,
-                                          guint           length,
-                                          guint           bytes1,
-                                          guint           bytes2,
-                                          const gboolean *affect);
-
 static inline void rotate_pointers       (guchar        **p,
                                           guint32         n);
 
@@ -2608,10 +2596,8 @@ combine_regions_replace (PixelRegion     *src1,
                          PixelRegion     *src2,
                          PixelRegion     *dest,
                          PixelRegion     *mask,
-                         const guchar    *data,
                          guint            opacity,
-                         const gboolean  *affect,
-                         CombinationMode  type)
+                         const gboolean  *affect)
 {
   gpointer pr;
 
@@ -2627,10 +2613,8 @@ combine_regions_replace (PixelRegion     *src1,
 
       for (h = 0; h < src1->h; h++)
         {
-          /*  Now, apply the paint mode  */
-          apply_layer_mode_replace (s1, s2, d, m, src1->x, src1->y + h,
-                                    opacity, src1->w,
-                                    src1->bytes, src2->bytes, affect);
+          replace_pixels (s1, s2, d, m, src1->w,
+                          opacity, affect, src1->bytes, src2->bytes);
 
           s1 += src1->rowstride;
           s2 += src2->rowstride;
@@ -2639,20 +2623,3 @@ combine_regions_replace (PixelRegion     *src1,
         }
     }
 }
-
-static void
-apply_layer_mode_replace (const guchar   *src1,
-                          const guchar   *src2,
-                          guchar         *dest,
-                          const guchar   *mask,
-                          gint            x,
-                          gint            y,
-                          guint           opacity,
-                          guint           length,
-                          guint           bytes1,
-                          guint           bytes2,
-                          const gboolean *affect)
-{
-  replace_pixels (src1, src2, dest, mask, length,
-                  opacity, affect, bytes1, bytes2);
-}
diff --git a/app/paint-funcs/paint-funcs.h b/app/paint-funcs/paint-funcs.h
index 10f5f68..d3f5764 100644
--- a/app/paint-funcs/paint-funcs.h
+++ b/app/paint-funcs/paint-funcs.h
@@ -254,10 +254,8 @@ void  combine_regions_replace             (PixelRegion    *src1,
                                            PixelRegion    *src2,
                                            PixelRegion    *dest,
                                            PixelRegion    *mask,
-                                           const guchar   *data,
                                            guint           opacity,
-                                           const gboolean *affect,
-                                           CombinationMode type);
+                                           const gboolean *affect);
 
 
 #endif  /*  __PAINT_FUNCS_H__  */



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