After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 764608 - Smudge tool clips out of gamut channel values on layers with alpha channels
Smudge tool clips out of gamut channel values on layers with alpha channels
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Tools
git master
Other All
: Normal normal
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2016-04-04 18:02 UTC by Elle Stone
Modified: 2016-05-23 16:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example smudge results with and without an alpha channel (45.76 KB, image/jpeg)
2016-04-04 18:02 UTC, Elle Stone
Details
test case (161.12 KB, application/x-xcf)
2016-04-05 06:17 UTC, Massimo
Details

Description Elle Stone 2016-04-04 18:02:29 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.
Comment 1 Massimo 2016-04-05 06:17:39 UTC
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.
Comment 2 Massimo 2016-04-05 06:21:05 UTC
(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.
Comment 3 Michael Natterer 2016-05-22 19:32:53 UTC
If you think that is right, please go ahead. That function is iirc
not used for anything else...
Comment 4 Elle Stone 2016-05-22 20:01:52 UTC
(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.
Comment 5 Massimo 2016-05-23 10:56:40 UTC
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.
Comment 6 Massimo 2016-05-23 16:48:23 UTC
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