[gimp/gimp-2-10] app: in gimppaintcore-loops, name algorithms more consistently



commit 1a06fa0c0ab7fad29e293e4c37fa8beb710e771b
Author: Ell <ell_se yahoo com>
Date:   Tue Feb 12 03:56:34 2019 -0500

    app: in gimppaintcore-loops, name algorithms more consistently
    
    In gimppaintcore-loops, make the algorithm names, and the names of
    the corresponding functions, more consistent.
    
    (cherry picked from commit d23e239fedb12c1fa454fa753edb6587e39a5a65)

 app/paint/gimppaintcore-loops.cc | 104 ++++++++++++++++++++-------------------
 app/paint/gimppaintcore-loops.h  |  90 ++++++++++++++++-----------------
 app/paint/gimppaintcore.c        |  20 ++++----
 3 files changed, 108 insertions(+), 106 deletions(-)
---
diff --git a/app/paint/gimppaintcore-loops.cc b/app/paint/gimppaintcore-loops.cc
index eadd102c75..23f3a77804 100644
--- a/app/paint/gimppaintcore-loops.cc
+++ b/app/paint/gimppaintcore-loops.cc
@@ -688,27 +688,27 @@ struct CanvasBufferIterator<Base, Access, 0> : Base
 };
 
 
-/* CombinePaintMaskToCanvasMaskToPaintBufAlpha,
- * dispatch_combine_paint_mask_to_canvas_mask_to_paint_buf_alpha():
+/* CombinePaintMaskToCanvasBufferToPaintBufAlpha,
+ * dispatch_combine_paint_mask_to_canvas_buffer_to_paint_buf_alpha():
  *
  * An algorithm class, providing an optimized version combining both the
- * COMBINE_PAINT_MASK_TO_CANVAS_MASK and the CANVAS_BUFFER_TO_PAINT_BUF_ALPHA
+ * COMBINE_PAINT_MASK_TO_CANVAS_BUFFER and the CANVAS_BUFFER_TO_PAINT_BUF_ALPHA
  * algorithms.  Used instead of the individual implementations, when both
  * algorithms are requested.
  */
 
 template <class Base>
-struct CombinePaintMaskToCanvasMaskToPaintBufAlpha :
+struct CombinePaintMaskToCanvasBufferToPaintBufAlpha :
   CanvasBufferIterator<Base, GEGL_BUFFER_READWRITE>
 {
   using base_type = CanvasBufferIterator<Base, GEGL_BUFFER_READWRITE>;
   using mask_type = typename base_type::mask_type;
 
   static constexpr guint filter =
-    base_type::filter                                                 |
-    GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_MASK |
-    GIMP_PAINT_CORE_LOOPS_ALGORITHM_CANVAS_BUFFER_TO_PAINT_BUF_ALPHA  |
-    GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUFFER;
+    base_type::filter                                                   |
+    GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_BUFFER |
+    GIMP_PAINT_CORE_LOOPS_ALGORITHM_CANVAS_BUFFER_TO_PAINT_BUF_ALPHA    |
+    GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUF_ALPHA;
 
   using base_type::base_type;
 
@@ -781,33 +781,34 @@ struct CombinePaintMaskToCanvasMaskToPaintBufAlpha :
 };
 
 static AlgorithmDispatch<
-  CombinePaintMaskToCanvasMaskToPaintBufAlpha,
-  GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_MASK |
+  CombinePaintMaskToCanvasBufferToPaintBufAlpha,
+  GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_BUFFER |
   GIMP_PAINT_CORE_LOOPS_ALGORITHM_CANVAS_BUFFER_TO_PAINT_BUF_ALPHA,
   decltype (dispatch_paint_buf),
   decltype (dispatch_paint_mask),
   decltype (dispatch_stipple)

-dispatch_combine_paint_mask_to_canvas_mask_to_paint_buf_alpha;
+dispatch_combine_paint_mask_to_canvas_buffer_to_paint_buf_alpha;
 
 
-/* CombinePaintMaskToCanvasMask, dispatch_combine_paint_mask_to_canvas_mask():
+/* CombinePaintMaskToCanvasBuffer,
+ * dispatch_combine_paint_mask_to_canvas_buffer():
  *
- * An algorithm class, implementing the COMBINE_PAINT_MASK_TO_CANVAS_MASK
+ * An algorithm class, implementing the COMBINE_PAINT_MASK_TO_CANVAS_BUFFER
  * algorithm.
  */
 
 template <class Base>
-struct CombinePaintMaskToCanvasMask :
+struct CombinePaintMaskToCanvasBuffer :
   CanvasBufferIterator<Base, GEGL_BUFFER_READWRITE>
 {
   using base_type = CanvasBufferIterator<Base, GEGL_BUFFER_READWRITE>;
   using mask_type = typename base_type::mask_type;
 
   static constexpr guint filter =
-    base_type::filter                                                 |
-    GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_MASK |
-    GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUFFER;
+    base_type::filter                                                   |
+    GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_BUFFER |
+    GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUF_ALPHA;
 
   using base_type::base_type;
 
@@ -874,12 +875,12 @@ struct CombinePaintMaskToCanvasMask :
 };
 
 static AlgorithmDispatch<
-  CombinePaintMaskToCanvasMask,
-  GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_MASK,
+  CombinePaintMaskToCanvasBuffer,
+  GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_BUFFER,
   decltype (dispatch_paint_mask),
   decltype (dispatch_stipple)

-dispatch_combine_paint_mask_to_canvas_mask;
+dispatch_combine_paint_mask_to_canvas_buffer;
 
 
 /* CanvasBufferToPaintBufAlpha, dispatch_canvas_buffer_to_paint_buf_alpha():
@@ -897,7 +898,7 @@ struct CanvasBufferToPaintBufAlpha : CanvasBufferIterator<Base,
   static constexpr guint filter =
     base_type::filter                                                |
     GIMP_PAINT_CORE_LOOPS_ALGORITHM_CANVAS_BUFFER_TO_PAINT_BUF_ALPHA |
-    GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUFFER;
+    GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUF_ALPHA;
 
   using base_type::base_type;
 
@@ -959,22 +960,23 @@ static AlgorithmDispatch<
 dispatch_canvas_buffer_to_paint_buf_alpha;
 
 
-/* PaintMaskToPaintBuffer, dispatch_paint_mask_to_paint_buffer():
+/* PaintMaskToPaintBufAlpha, dispatch_paint_mask_to_paint_buf_alpha():
  *
- * An algorithm class, implementing the PAINT_MASK_TO_PAINT_BUFFER algorithm.
+ * An algorithm class, implementing the PAINT_MASK_TO_PAINT_BUF_ALPHA
+ * algorithm.
  */
 
 template <class Base>
-struct PaintMaskToPaintBuffer : Base
+struct PaintMaskToPaintBufAlpha : Base
 {
   using mask_type = typename Base::mask_type;
 
   static constexpr guint filter =
     Base::filter |
-    GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUFFER;
+    GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUF_ALPHA;
 
   explicit
-  PaintMaskToPaintBuffer (const GimpPaintCoreLoopsParams *params) :
+  PaintMaskToPaintBufAlpha (const GimpPaintCoreLoopsParams *params) :
     Base (params)
   {
     /* Validate that the paint buffer is within the bounds of the paint mask */
@@ -1020,12 +1022,12 @@ struct PaintMaskToPaintBuffer : Base
 };
 
 static AlgorithmDispatch<
-  PaintMaskToPaintBuffer,
-  GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUFFER,
+  PaintMaskToPaintBufAlpha,
+  GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUF_ALPHA,
   decltype (dispatch_paint_buf),
   decltype (dispatch_paint_mask)

-dispatch_paint_mask_to_paint_buffer;
+dispatch_paint_mask_to_paint_buf_alpha;
 
 
 /* DoLayerBlend, dispatch_do_layer_blend():
@@ -1271,29 +1273,29 @@ gimp_paint_core_loops_process (const GimpPaintCoreLoopsParams *params,
         });
     },
     params, algorithms, identity<AlgorithmBase> (),
-    dispatch_combine_paint_mask_to_canvas_mask_to_paint_buf_alpha,
-    dispatch_combine_paint_mask_to_canvas_mask,
+    dispatch_combine_paint_mask_to_canvas_buffer_to_paint_buf_alpha,
+    dispatch_combine_paint_mask_to_canvas_buffer,
     dispatch_canvas_buffer_to_paint_buf_alpha,
-    dispatch_paint_mask_to_paint_buffer,
+    dispatch_paint_mask_to_paint_buf_alpha,
     dispatch_do_layer_blend);
 }
 
 
-/* combine_paint_mask_to_canvas_mask():
+/* combine_paint_mask_to_canvas_buffer():
  *
  * A convenience wrapper around 'gimp_paint_core_loops_process()', performing
- * just the COMBINE_PAINT_MASK_TO_CANVAS_MASK algorithm.
+ * just the COMBINE_PAINT_MASK_TO_CANVAS_BUFFER algorithm.
  */
 
 void
-combine_paint_mask_to_canvas_mask (const GimpTempBuf *paint_mask,
-                                   gint               mask_x_offset,
-                                   gint               mask_y_offset,
-                                   GeglBuffer        *canvas_buffer,
-                                   gint               x_offset,
-                                   gint               y_offset,
-                                   gfloat             opacity,
-                                   gboolean           stipple)
+combine_paint_mask_to_canvas_buffer (const GimpTempBuf *paint_mask,
+                                     gint               mask_x_offset,
+                                     gint               mask_y_offset,
+                                     GeglBuffer        *canvas_buffer,
+                                     gint               x_offset,
+                                     gint               y_offset,
+                                     gfloat             opacity,
+                                     gboolean           stipple)
 {
   GimpPaintCoreLoopsParams params = {};
 
@@ -1312,7 +1314,7 @@ combine_paint_mask_to_canvas_mask (const GimpTempBuf *paint_mask,
 
   gimp_paint_core_loops_process (
     &params,
-    GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_MASK);
+    GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_BUFFER);
 }
 
 
@@ -1342,18 +1344,18 @@ canvas_buffer_to_paint_buf_alpha (GimpTempBuf  *paint_buf,
 }
 
 
-/* paint_mask_to_paint_buffer():
+/* paint_mask_to_paint_buf_alpha():
  *
  * A convenience wrapper around 'gimp_paint_core_loops_process()', performing
- * just the PAINT_MASK_TO_PAINT_BUFFER algorithm.
+ * just the PAINT_MASK_TO_PAINT_BUF_ALPHA algorithm.
  */
 
 void
-paint_mask_to_paint_buffer (const GimpTempBuf  *paint_mask,
-                            gint                mask_x_offset,
-                            gint                mask_y_offset,
-                            GimpTempBuf        *paint_buf,
-                            gfloat              paint_opacity)
+paint_mask_to_paint_buf_alpha (const GimpTempBuf  *paint_mask,
+                               gint                mask_x_offset,
+                               gint                mask_y_offset,
+                               GimpTempBuf        *paint_buf,
+                               gfloat              paint_opacity)
 {
   GimpPaintCoreLoopsParams params = {};
 
@@ -1367,7 +1369,7 @@ paint_mask_to_paint_buffer (const GimpTempBuf  *paint_mask,
 
   gimp_paint_core_loops_process (
     &params,
-    GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUFFER);
+    GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUF_ALPHA);
 }
 
 
diff --git a/app/paint/gimppaintcore-loops.h b/app/paint/gimppaintcore-loops.h
index 605dd369f8..68df8faa21 100644
--- a/app/paint/gimppaintcore-loops.h
+++ b/app/paint/gimppaintcore-loops.h
@@ -21,12 +21,12 @@
 
 typedef enum
 {
-  GIMP_PAINT_CORE_LOOPS_ALGORITHM_NONE                              = 0,
+  GIMP_PAINT_CORE_LOOPS_ALGORITHM_NONE                                = 0,
 
-  GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_MASK = 1 << 0,
-  GIMP_PAINT_CORE_LOOPS_ALGORITHM_CANVAS_BUFFER_TO_PAINT_BUF_ALPHA  = 1 << 1,
-  GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUFFER        = 1 << 2,
-  GIMP_PAINT_CORE_LOOPS_ALGORITHM_DO_LAYER_BLEND                    = 1 << 3
+  GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_BUFFER = 1 << 0,
+  GIMP_PAINT_CORE_LOOPS_ALGORITHM_CANVAS_BUFFER_TO_PAINT_BUF_ALPHA    = 1 << 1,
+  GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUF_ALPHA       = 1 << 2,
+  GIMP_PAINT_CORE_LOOPS_ALGORITHM_DO_LAYER_BLEND                      = 1 << 3
 } GimpPaintCoreLoopsAlgorithm;
 
 
@@ -58,46 +58,46 @@ typedef struct
 } GimpPaintCoreLoopsParams;
 
 
-void gimp_paint_core_loops_process      (const GimpPaintCoreLoopsParams *params,
-                                         GimpPaintCoreLoopsAlgorithm     algorithms);
-
-void combine_paint_mask_to_canvas_mask  (const GimpTempBuf              *paint_mask,
-                                         gint                            mask_x_offset,
-                                         gint                            mask_y_offset,
-                                         GeglBuffer                     *canvas_buffer,
-                                         gint                            x_offset,
-                                         gint                            y_offset,
-                                         gfloat                          opacity,
-                                         gboolean                        stipple);
-
-void canvas_buffer_to_paint_buf_alpha   (GimpTempBuf                    *paint_buf,
-                                         GeglBuffer                     *canvas_buffer,
-                                         gint                            x_offset,
-                                         gint                            y_offset);
-
-void paint_mask_to_paint_buffer         (const GimpTempBuf              *paint_mask,
-                                         gint                            mask_x_offset,
-                                         gint                            mask_y_offset,
-                                         GimpTempBuf                    *paint_buf,
-                                         gfloat                          paint_opacity);
-
-void do_layer_blend                     (GeglBuffer                     *src_buffer,
-                                         GeglBuffer                     *dst_buffer,
-                                         GimpTempBuf                    *paint_buf,
-                                         GeglBuffer                     *mask_buffer,
-                                         gfloat                          opacity,
-                                         gint                            x_offset,
-                                         gint                            y_offset,
-                                         gint                            mask_x_offset,
-                                         gint                            mask_y_offset,
-                                         GimpLayerMode                   paint_mode);
-
-void mask_components_onto               (GeglBuffer                     *src_buffer,
-                                         GeglBuffer                     *aux_buffer,
-                                         GeglBuffer                     *dst_buffer,
-                                         const GeglRectangle            *roi,
-                                         GimpComponentMask               mask,
-                                         gboolean                        linear_mode);
+void gimp_paint_core_loops_process       (const GimpPaintCoreLoopsParams *params,
+                                          GimpPaintCoreLoopsAlgorithm     algorithms);
+
+void combine_paint_mask_to_canvas_buffer (const GimpTempBuf              *paint_mask,
+                                          gint                            mask_x_offset,
+                                          gint                            mask_y_offset,
+                                          GeglBuffer                     *canvas_buffer,
+                                          gint                            x_offset,
+                                          gint                            y_offset,
+                                          gfloat                          opacity,
+                                          gboolean                        stipple);
+
+void canvas_buffer_to_paint_buf_alpha    (GimpTempBuf                    *paint_buf,
+                                          GeglBuffer                     *canvas_buffer,
+                                          gint                            x_offset,
+                                          gint                            y_offset);
+
+void paint_mask_to_paint_buf_alpha       (const GimpTempBuf              *paint_mask,
+                                          gint                            mask_x_offset,
+                                          gint                            mask_y_offset,
+                                          GimpTempBuf                    *paint_buf,
+                                          gfloat                          paint_opacity);
+
+void do_layer_blend                      (GeglBuffer                     *src_buffer,
+                                          GeglBuffer                     *dst_buffer,
+                                          GimpTempBuf                    *paint_buf,
+                                          GeglBuffer                     *mask_buffer,
+                                          gfloat                          opacity,
+                                          gint                            x_offset,
+                                          gint                            y_offset,
+                                          gint                            mask_x_offset,
+                                          gint                            mask_y_offset,
+                                          GimpLayerMode                   paint_mode);
+
+void mask_components_onto                (GeglBuffer                     *src_buffer,
+                                          GeglBuffer                     *aux_buffer,
+                                          GeglBuffer                     *dst_buffer,
+                                          const GeglRectangle            *roi,
+                                          GimpComponentMask               mask,
+                                          gboolean                        linear_mode);
 
 
 #endif /* __GIMP_PAINT_CORE_LOOPS_H__ */
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index e271605407..e9b4b6c342 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -904,7 +904,7 @@ gimp_paint_core_paste (GimpPaintCore            *core,
               params.stipple             = GIMP_IS_AIRBRUSH (core);
               params.paint_opacity       = paint_opacity;
 
-              algorithms |= GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_MASK;
+              algorithms |= GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_BUFFER;
             }
 
           /* Write canvas_buffer to paint_buf */
@@ -923,7 +923,7 @@ gimp_paint_core_paste (GimpPaintCore            *core,
           params.paint_mask_offset_y = paint_mask_offset_y;
           params.paint_opacity       = paint_opacity;
 
-          algorithms |= GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUFFER;
+          algorithms |= GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUF_ALPHA;
 
           /* dest_buffer -> paint_buf -> dest_buffer */
           if (core->comp_buffer)
@@ -1036,14 +1036,14 @@ gimp_paint_core_replace (GimpPaintCore            *core,
       else
         {
           /* Mix paint mask and canvas_buffer */
-          combine_paint_mask_to_canvas_mask (paint_mask,
-                                             paint_mask_offset_x,
-                                             paint_mask_offset_y,
-                                             core->canvas_buffer,
-                                             core->paint_buffer_x,
-                                             core->paint_buffer_y,
-                                             paint_opacity,
-                                             GIMP_IS_AIRBRUSH (core));
+          combine_paint_mask_to_canvas_buffer (paint_mask,
+                                               paint_mask_offset_x,
+                                               paint_mask_offset_y,
+                                               core->canvas_buffer,
+                                               core->paint_buffer_x,
+                                               core->paint_buffer_y,
+                                               paint_opacity,
+                                               GIMP_IS_AIRBRUSH (core));
         }
 
       /* initialize the maskPR from the canvas buffer */


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