app: refactor gimppaintcore-loops to coalesce iteration

Desktop / GNOME / GIMP - Ell [yahoo.com] - 19 April 2018 09:36 EDT

The gimppaintcore-loops functions perform very little actual computational work (in case of do_layer_blend(), at least for simple blend modes), which makes the cost of buffer iteration, and memory bandwidth, nonnegligible factors. Since these functions are usually called in succession, acessing the same region of the same buffers, using the same foramts, coalescing them into a single function, which performs all the necessary processing in a single step, can improve performance when these functions are the bottleneck.

Add a gimp_paint_core_loops_process() function, which does just that: it takes a set of algorithms to run, and a set of parameters, and performs all of them in one go. The individual functions are kept for convenience, but are merely wrappers around gimp_paint_core_loops_process().

Be warned: the implementation uses unholy C++ from outer space, in order to make this (sort of) managable. See the comments for more details.

f2a1fd5bf0 app: refactor gimppaintcore-loops to coalesce iteration
app/paint/gimppaintcore-loops.cc | 1494 ++++++++++++++++++++++++++++++--------
app/paint/gimppaintcore-loops.h | 116 ++-
app/paint/gimppaintcore.c | 75 +-
3 files changed, 1315 insertions(+), 370 deletions(-)

Upstream: git.gnome.org


  • Share