GNOME Bugzilla – Bug 764552
Painting using LCH blend modes produces solid squares
Last modified: 2017-02-14 16:18:38 UTC
Created attachment 325270 [details] Solid squares when using an LCH blend mode Painting using LCH blend modes sometimes produces solid squares instead of whatever pattern the brush tip actually has. This might be a recent issue as I'm sure I've painted using LCH blend modes in the past. GIMP commit c3c2e29 shows this problem. I'm not sure what exact combination of layers/etc triggers the problem because it doesn't happen immediately. But once it gets triggered, it persists across closing and opening the image, closing and opening GIMP, and across prefixes (that is, closing the image in GIMP installed in one prefix and opening the image in GIMP installed in another prefix).
Removing the alpha channel seems to allow to paint without producing just squares of color. Adding the alpha channel back in restarts the painting of squares.
I was planning to file a separate bug report on the smudge tool, as smudging across out-of-gamut channel values results in the immediate clipping instead of smooth blending of the out-of-gamut channel values. Plus smudging over out-of-gamut channel values creates square edges at the start of the smudge-brushed area. But it turns out that removing the layer alpha channel allows to smudge across out-of-gamut channel values without any clipping or square-edged "smudging". So there seems to be an unwanted interaction between painting and alpha channels.
Created attachment 325304 [details] [review] quick hack It is an invalid assumption I made. The paint engine is passing the same buffer for input and output and so it is wrong to store there intermediate values because the input is still used later. I will check later whether the same problem affects other LCH based layer modes
Created attachment 325342 [details] [review] proposed patch The problem affects painting on layers with alpha channel of images whose precision is floating point for all lch layer modes as it was written in the original report.
I applied the patch and so far I haven't been able to trigger the painting of squares for the LCH blend modes even when the layer has an alpha channel. Many thanks! Should I file a separate bug report for the Smudge tool?
(In reply to Elle Stone from comment #5) > I applied the patch and so far I haven't been able to trigger the painting > of squares for the LCH blend modes even when the layer has an alpha channel. > Many thanks! > > Should I file a separate bug report for the Smudge tool? Well, I'd say it is unrelated and so yes. I've rapidly looked for the first time to smudge tool code and (it's code I don't know) I didn't find anything evidently wrong.
(In reply to Massimo from comment #6) > (In reply to Elle Stone from comment #5) > > I applied the patch and so far I haven't been able to trigger the painting > > of squares for the LCH blend modes even when the layer has an alpha channel. > > Many thanks! > > > > Should I file a separate bug report for the Smudge tool? > > Well, I'd say it is unrelated and so yes. > > I've rapidly looked for the first time to smudge tool > code and (it's code I don't know) I didn't find anything > evidently wrong. Here's the bug report: https://bugzilla.gnome.org/show_bug.cgi?id=764608 I also looked through the code. But I was looking for clamping code because I hadn't realized that the issue disappears if the alpha channel is removed.
Review of attachment 325342 [details] [review]: Do we really want to allocate that temp buffer instead of just allocating it on the stack (g_alloca)?
(In reply to Michael Natterer from comment #8) > Review of attachment 325342 [details] [review] [review]: > > Do we really want to allocate that temp buffer instead of just > allocating it on the stack (g_alloca)? I did not want to, in fact I made sure the op classes are ->want_in_place = FALSE but the paint engine is not using that flag. I did not opt for g_alloca because the _pre_process functions are already using a variable length array and the allocation happens only when painting with layer formats "RGBA float" or "R'G'B'A float". The projection does not pay that cost. Anyway feel free to clean it as you like
Comment on attachment 325342 [details] [review] proposed patch Per comments.
Everything here has changed, does this still happen at all?
I did some testing using GIMP as of this AM, trying to replicate the squares in attachment 325270 [details]. I wasn't able to trigger the "squares" while painting with any of the LCH blend modes. So maybe this doesn't happen any more.
Thanks, I guess this got fixed by the complete rewrite all of that code has seen.