[gimp] app: in gimppaintcore-loops, name algorithms more consistently
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: in gimppaintcore-loops, name algorithms more consistently
- Date: Tue, 12 Feb 2019 14:30:30 +0000 (UTC)
commit d23e239fedb12c1fa454fa753edb6587e39a5a65
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.
app/paint/gimppaintcore-loops.cc | 104 ++++++++++++++++++++-------------------
app/paint/gimppaintcore-loops.h | 92 +++++++++++++++++-----------------
app/paint/gimppaintcore.c | 20 ++++----
3 files changed, 109 insertions(+), 107 deletions(-)
---
diff --git a/app/paint/gimppaintcore-loops.cc b/app/paint/gimppaintcore-loops.cc
index faa0ef705b..2b22b3f655 100644
--- a/app/paint/gimppaintcore-loops.cc
+++ b/app/paint/gimppaintcore-loops.cc
@@ -690,27 +690,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;
@@ -783,33 +783,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;
@@ -876,12 +877,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():
@@ -899,7 +900,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;
@@ -961,22 +962,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 */
@@ -1022,12 +1024,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():
@@ -1273,29 +1275,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 = {};
@@ -1314,7 +1316,7 @@ combine_paint_mask_to_canvas_mask (const GimpTempBuf *paint_mask,
gimp_paint_core_loops_process (
¶ms,
- GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_MASK);
+ GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_BUFFER);
}
@@ -1344,18 +1346,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 = {};
@@ -1369,7 +1371,7 @@ paint_mask_to_paint_buffer (const GimpTempBuf *paint_mask,
gimp_paint_core_loops_process (
¶ms,
- 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 6d8fb9a459..bd60db585f 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,47 +58,47 @@ 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,
- GimpTRCType trc,
- const Babl *space);
+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,
+ GimpTRCType trc,
+ const Babl *space);
#endif /* __GIMP_PAINT_CORE_LOOPS_H__ */
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index 079af19f71..f7183e763a 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -905,7 +905,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 */
@@ -924,7 +924,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)
@@ -1038,14 +1038,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]