app: in gimppaintcore-loops, make sure dest_buffer is the primary iterator buffer

In gimppaintcore-loops, in the DO_LAYER_BLEND paint algorithm, and
in the CanvasBufferIterator algorithm helper-class, initialize the
iterator *before* initializing the base class, to make sure that
dest_buffer, or canvas_buffer, respectively and in that order, is
the primary buffer of the iterator.  In particular, this avoids the
mask buffer being the primary buffer.  This is desirable, since
most of the buffers we iterate over are tile-aligned to the dest/
canvas buffers.
This commit is contained in:
Ell 2019-02-11 03:42:16 -05:00
parent 44281ce2c4
commit f9c072c328
1 changed files with 12 additions and 4 deletions

View File

@ -909,11 +909,15 @@ struct CanvasBufferIterator<Base, Access, 0> : Base
const GeglRectangle *roi,
const GeglRectangle *area) const
{
Base::init (params, state, iter, roi, area);
state->canvas_buffer_iterator = gegl_buffer_iterator_add (
iter, params->canvas_buffer, area, 0, babl_format ("Y float"),
Derived::canvas_buffer_access, GEGL_ABYSS_NONE);
/* initialize the base class *after* initializing the iterator, to make
* sure that canvas_buffer is the primary buffer of the iterator, if no
* subclass added an iterator first.
*/
Base::init (params, state, iter, roi, area);
}
};
@ -1319,8 +1323,6 @@ struct DoLayerBlend : Base
const GeglRectangle *roi,
const GeglRectangle *area) const
{
Base::init (params, state, iter, roi, area);
state->iterator_base = gegl_buffer_iterator_add (iter, params->dest_buffer,
area, 0, iterator_format,
GEGL_ACCESS_WRITE,
@ -1329,6 +1331,12 @@ struct DoLayerBlend : Base
gegl_buffer_iterator_add (iter, params->src_buffer, area, 0,
iterator_format,
GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
/* initialize the base class *after* initializing the iterator, to make
* sure that dest_buffer is the primary buffer of the iterator, if no
* subclass added an iterator first.
*/
Base::init (params, state, iter, roi, area);
}
template <class Derived>