https://bugs.kde.org/show_bug.cgi?id=493593

            Bug ID: 493593
           Summary: Undo preview generation visibly freezes krita for
                    serveral seconds when working with large transparent
                    images
    Classification: Applications
           Product: krita
           Version: 5.2.5
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: * Unknown
          Assignee: krita-bugs-n...@kde.org
          Reporter: darkdefe...@gmail.com
  Target Milestone: ---

Created attachment 174032
  --> https://bugs.kde.org/attachment.cgi?id=174032&action=edit
Krita file with slow thumbnail generation

SUMMARY

When working with large images (7680 x 4320) with large transparent areas, the
undo image thumbnail generation freezes redrawing of the Krita UI after every
operation for a long time.

The reason for this is that even if the undo history docker is hidden,
thumbnails is generated.
The slow code path is `m_paintDevice->exactBounds()` that was introduced in:
https://invent.kde.org/graphics/krita/-/commit/b67e2556bb2944f56c0a4ca9bd77a1f29f8e05df

Because it loops over potentially all pixels in the image to find any opaque
pixels, probably best to not do this in a locking manner for the undo system.
(Or perhaps generate the undo thumbnails on demand if the undo history docker
is visible?

Note that I'm specifically pointing to the undo thumbnail creation here as I
ran krita with a profiler (hotspot) and it showed that after each stroke it
seems like all activity was in a single thread doing `exactBounds`
calculations.

If I shorted out the exact bounds function to return early without doing any
calculations, krita was really fast and responsive again.

STEPS TO REPRODUCE
1. Open the krita file I have attached in the .7z archive
2. Draw a stroke in the middle of the image
3. Notice that the krita UI freezes after finishing the stroke
4. Add a opaque pixel at every corner of the image
5. Notice that now drawing in the middle is really fast and responsive

OBSERVED RESULT
The krita UI freezes after every stroke when an image has large transparent
areas

EXPECTED RESULT
Thumbnail creations shouldn't lockup the UI and degrade the overall performance
of Krita.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Gentoo Linux
KDE Plasma Version: 6.1.5
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.2

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to