From 4d5ea7fd95bbd7d57b090ca009555b8a876a4e18 Mon Sep 17 00:00:00 2001 From: Ell Date: Thu, 9 Jan 2020 22:26:35 +0200 Subject: [PATCH] Issue #4354 - When using color to fade dynamics and gradient with transparency ... ... brush does not have transparency In the PAINT_MASK_TO_COMP_MASK paintcore-loops algorithm, used when painting incrementally, multiply the paint mask values by the paint opacity. Previously, the paint opacity was ignored, breaking various dynamics affecting the opacity. (cherry picked from commit 9fe33702fb051922072831b23b432040ac2225ec) --- app/paint/gimppaintcore-loops.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/paint/gimppaintcore-loops.cc b/app/paint/gimppaintcore-loops.cc index 2180c547be..0702fcd712 100644 --- a/app/paint/gimppaintcore-loops.cc +++ b/app/paint/gimppaintcore-loops.cc @@ -1723,7 +1723,8 @@ struct PaintMaskToCompMask : Base for (x = 0; x < rect->width; x++) { comp_mask_pixel[0] = value_to_float (mask_pixel[0]) * - state->mask_pixel[0]; + state->mask_pixel[0] * + params->paint_opacity; comp_mask_pixel += 1; mask_pixel += 1; @@ -1734,7 +1735,8 @@ struct PaintMaskToCompMask : Base { for (x = 0; x < rect->width; x++) { - comp_mask_pixel[0] = value_to_float (mask_pixel[0]); + comp_mask_pixel[0] = value_to_float (mask_pixel[0]) * + params->paint_opacity; comp_mask_pixel += 1; mask_pixel += 1; @@ -1841,7 +1843,10 @@ struct DispatchPaintMaskToCompMask { using NewAlgorithm = typename decltype (algorithm)::type; - Dispatch () (visitor, params, algorithms, algorithm); + if (params->paint_opacity == GIMP_OPACITY_OPAQUE) + Dispatch () (visitor, params, algorithms, algorithm); + else + DispatchIndirect () (visitor, params, algorithms, algorithm); }, params, algorithms, algorithm, dispatch_paint_mask,