Bug 480973 - Layers getting blurred after transform other layer when "accurate instant preview" is enabled
Summary: Layers getting blurred after transform other layer when "accurate instant pre...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Transform (show other bugs)
Version: 5.2.2
Platform: Flatpak Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-06 22:54 UTC by heroshiheroart
Modified: 2024-09-06 15:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
How it looks / How it should look (2.91 MB, image/png)
2024-02-06 22:54 UTC, heroshiheroart
Details
Bug reproduction (2.33 MB, video/webm)
2024-02-26 17:26 UTC, heroshiheroart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description heroshiheroart 2024-02-06 22:54:23 UTC
Created attachment 165631 [details]
How it looks / How it should look

SUMMARY
Sometimes I use Krita as image editor to avoid using GIMP, while the general experience is pretty good, but I found a very annoying bug when transforming the layers, where the layers bellow the transformed image get blurred after transforming it. But it only occurs when the "accurate instant preview" is enabled.

STEPS TO REPRODUCE
1. Pick two images and insert them in your file (drag and dropping or pasting), at different layers
2. Select the first layer in your list and transform it with CTRL+T
3. When transforming, move it to above the second layer, zoom out quickly with the mouse scroll and press enter

OBSERVED RESULT
The layer bellow get blurred after transform.

EXPECTED RESULT
The layers bellow don't get blurred after transform.

SOFTWARE/OS VERSIONS
Krita
 Version: 5.2.2
 Hidpi: true
Qt
  Version (compiled): 5.15.7
  Version (loaded): 5.15.7
OS Information
  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 6.1.0-17-amd64
  Pretty Productname: Freedesktop SDK 22.08 (Flatpak runtime)
  Product Type: org.freedesktop.platform
  Product Version: 22.08
  Desktop: i3
  Appimage build: No

ADDITIONAL INFORMATION
- I'm using the flatpak version with an AMD Polaris card, also tested the appimage and happened the same bug
- Two possible temporary workarrounds are: Change the Settings>Configure Krita>Display>Canvas Acelleration>Scaling Mode to "Bilinear Filtering" instead of "Trilinear" or "High Quality Filtering";  When using the transform tool, change the preview mode to "Fast" or "Accurate" instead of using "Accurate with Instant Preview".
- If you transform the blurred layer, it goes back to normal.
- I don't have access to other graphical API that aren't OpenGL.
Comment 1 heroshiheroart 2024-02-26 17:26:34 UTC
Created attachment 166110 [details]
Bug reproduction
Comment 2 heroshiheroart 2024-03-01 22:59:35 UTC
(In reply to heroshiheroart from comment #1)
> Created attachment 166110 [details]
> Bug reproduction

Now reading the documentation and with my experience reproducing this bug, I suppose as not-so-tech person, that can a problem with the scaling mode + instant preview, and it happens with filters, moving tool and the transform tool. When you zoom in/out, Krita and other drawing software, recalculates the canvas and apply the filtering (Nearest/Bilinear/Trilinear). That means: If you zoom in/out while transforming with the scaling mode enabled, and conclude the process, it "fails" to recalculate the canvas, and the layers get those blurred areas on them. What makes me endorse this supposition is that after you reproduce this bug, you can just create a new layer and the image goes back to normal, because it applies the scaling mode properly.

The solution I suppose is: find a way to the process of transforming, moving or insert filters with the instant preview enabled doesn't interfere/stop the process of recalculating the canvas scaling. At the worst, maybe it would require a rework at one of them to it work properly.
Comment 3 Dmitry Kazakov 2024-08-23 14:00:47 UTC
Hi, heroshiheroart!

As a workaround for this bug it should be enough just to toggle the visibility of the background layer twice to get the full-resolution image visible again. 

But I will look into a proper solution for the bug.
Comment 4 Dmitry Kazakov 2024-08-23 14:22:49 UTC
I can reproduce the issue. The tool re-uploads only the areas where the new clip is, not the other ones.
Comment 5 Dmitry Kazakov 2024-08-26 12:09:11 UTC
Git commit 72ba9e40a043058ee2c0e4381d925ffb69f57e5e by Dmitry Kazakov.
Committed on 26/08/2024 at 12:08.
Pushed by dkazakov into branch 'master'.

Fix mipmaps not being regenerated after transformation was finished or cancelled

The final update will update only the "final" region, not all the parts fo the canvas
that were touched during the transformation preview. So we need to update them
at the end of the action.

M  +44   -0    plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.cpp
M  +2    -0    plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.h

https://invent.kde.org/graphics/krita/-/commit/72ba9e40a043058ee2c0e4381d925ffb69f57e5e
Comment 6 Dmitry Kazakov 2024-08-27 06:58:28 UTC
Git commit e6e9900de326ad46c35804d72ee76c6c6782f78c by Dmitry Kazakov.
Committed on 27/08/2024 at 06:57.
Pushed by dkazakov into branch 'krita/5.2'.

Fix mipmaps not being regenerated after transformation was finished or cancelled

The final update will update only the "final" region, not all the parts fo the canvas
that were touched during the transformation preview. So we need to update them
at the end of the action.

M  +44   -0    plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.cpp
M  +2    -0    plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.h

https://invent.kde.org/graphics/krita/-/commit/e6e9900de326ad46c35804d72ee76c6c6782f78c
Comment 7 heroshiheroart 2024-09-06 15:04:21 UTC
Tested with 5.2.5 pre-alpha (git ecf3f19), now the canvas render properly after transform, but this issue of the images getting blurred also happens while transforming, the object and the canvas get blurred with instant preview enabled because it doesn't re-upload the image/layer. Should I open other issue about it?