GNOME Bugzilla – Bug 764608
Smudge tool clips out of gamut channel values on layers with alpha channels
Last modified: 2016-05-23 16:48:23 UTC
Created attachment 325369 [details] Example smudge results with and without an alpha channel At floating point precision, if the Smudge tool is used on colors with out of gamut channel values, and the layer has an alpha channel, the out of gamut channel values are clipped. Also the brush shape becomes square, regardless of what the brush shape actually is. If the alpha channel is removed before using the Smudge too, the out of gamut channel values are blended properly and the brush has its proper shape.
Created attachment 325402 [details] test case The problem is here: https://git.gnome.org/browse/gimp/tree/app/gegl/gimp-gegl-loops.c#n588 replacing MIN (new_val, 1.0) with new_val let you smudge inside the pink area without leaving the 'in gamut' trail. Unfortunately without a test suite I can't say when the MIN is necessary.
(In reply to Massimo from comment #1) > Created attachment 325402 [details] > test case > > The problem is here: > > https://git.gnome.org/browse/gimp/tree/app/gegl/gimp-gegl-loops.c#n588 > I replaced both MIN occurrences in that function > replacing > > MIN (new_val, 1.0) > > with > > new_val > > let you smudge inside the pink area without leaving > the 'in gamut' trail.
If you think that is right, please go ahead. That function is iirc not used for anything else...
(In reply to Michael Natterer from comment #3) > If you think that is right, please go ahead. FWIW I've been using Massimo's suggested replacement code for smudge painting pretty much since he posted the code, and so far everything works just fine.
If that MIN is there because it was here (gimp-2-8 sources): https://git.gnome.org/browse/gimp/tree/app/paint-funcs/paint-funcs-generic.h?h=gimp-2-8#n432 I can say that in gimp-2-8 it is redundant. Assuming opacity is always in the range [0 255], new_val can't be > 255. So I think that removing it does not introduce regressions compared to gimp-2.8 I'll push a fix later.
fixed in master after: commit 9e969961386e3080ed5fcb334369e39fd288f369 Author: Massimo Valentini <mvalentini@src.gnome.org> Date: Mon May 23 18:45:49 2016 +0200 Bug 764608: Smudge tool clips out of gamut channel values... on layers with alpha channels