Bug 415439 - The Fill Tool is memory overconsumption.
Summary: The Fill Tool is memory overconsumption.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools (show other bugs)
Version: 4.2.8
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-21 22:24 UTC by KuroiZ64
Modified: 2022-02-23 15:02 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Thumbnail before and after delete free space (271.91 KB, image/png)
2019-12-21 22:24 UTC, KuroiZ64
Details

Note You need to log in before you can comment on or make changes to this bug.
Description KuroiZ64 2019-12-21 22:24:28 UTC
Created attachment 124644 [details]
Thumbnail before and after delete free space

SUMMARY


STEPS TO REPRODUCE
1. Create New layer
2. Select area
3. Fill

OBSERVED RESULT
On layer thumbnail, layer occupies the entire canvas.

EXPECTED RESULT
if i delete free space around, then layer takes only visible space, as it should and release a part of used memory.

SOFTWARE/OS VERSIONS
Debian 10.0 XFCE krita-4.2.8-x86_64.appimage
Comment 1 Ahab Greybeard 2019-12-22 12:31:01 UTC
This is interesting and best observed with only one new transparent paint layer in the image.

If you fill a selection with a colour then the entire layer is filled with that colour but inside the selection the Alpha=255 and outside the selection the Alpha=0. This is observed using the Colour Selector Tool's display of RGB/A values.

If you then Invert the selection and perform a Clear (Del) action, the displayed RGB/A values don't change and there is no change in the layer appearance but RAM usage drops and you see this in the layer thumbnail as was described.

If you then Undo Clear, the entire selected area (outside the original filled selection) becomes filled with the colour so that the entire layer is filled with visible colour. This is obviously not the correct result from a user's point of view.

What does Clear actually do?
What does Undoing Clear actually do?
If an area is tranpsarent, what RGB values should it have?

I'll set this to Confirmed because the behaviour results in some inconsistency.
Comment 2 Tiar 2019-12-26 17:31:10 UTC
@Ahab the issue with undoing is I believe another bug, even if is related or the reproduction is similar.

This bug is related to bug 412560 and maybe bug 414903.
Comment 3 Ahab Greybeard 2019-12-27 09:50:44 UTC
@Tymond It does look like it's related to the other bugs you mentioned, i.e. the empty/non-empty tiles situation. Maybe you should mark it as a Duplicate for these?

As for the points I raised in my comment, I've looked at this again and I'll have to withdraw my observations as follows:

1. The Undo Clear now does not fill the area outside the original region with colour. It did, I swear it did, but it now no longer happens.

2. My observations about the RGB/A values outside the selected region are, I believe, not valid because the colour picker seems to not update the RGB values if A=0, but it does update the A value. Maybe this is to be expected?

I've made further tests and observations where, according to the layer thumbnail, there is off-canvas content introduced. A Trim to Image Size reduces the memory required and also sets the layer thumbnail back to the original appearance. However, this behaviour depends on the size of the image and using different sizes of image gives different results.

Also, painting outside the selected region increases the memory required and then Clearing outside the original region (which is transparent) reduces the memory. Again, this is variable depending on the size of the image. It is confusing.

At this stage, I'm not going to do detailed testing and reports but I'd be happy to do that if you feel it would be useful.
Comment 4 wolthera 2020-08-22 10:41:21 UTC
Has this been resolved?
Comment 5 Ahab Greybeard 2020-08-22 18:47:52 UTC
Doing this with the Aug 21 4.4.0 alpha (git ba852b2) appimage and comparing the same test with the 4.2.8 appimage shows that there is now no additional content as indicated by the thumbnail and the RAM indicator.

Setting to RESOLVED FIXED
Comment 6 Tiar 2020-08-22 18:49:44 UTC
@Ahab are you using the "Use selection as boundary" mode? It does fix the issue. However I believe that unchecking it will still result in this bug.
Comment 7 Ahab Greybeard 2020-08-22 18:59:18 UTC
@Tymond: You are correct.
With 'Use selection as boundary:' unchecked, there is content outside the selection as indicated on the thumbnail and notable increased RAM usage with the Aug 21 4.4.0 alpha appimage.

Setting to REPORTED
Comment 8 Deif Lou 2022-02-23 15:02:28 UTC
Git commit 96871c73cef66935edd00e267c497702beb29697 by Deif Lou.
Committed on 23/02/2022 at 15:01.
Pushed by deiflou into branch 'master'.

Make fill tool produce regions with minimal size when a selection is used

M  +5    -1    libs/image/kis_fill_painter.cc

https://invent.kde.org/graphics/krita/commit/96871c73cef66935edd00e267c497702beb29697