| Summary: | Krita briefly freezes when selecting brush presets for the first time | ||
|---|---|---|---|
| Product: | [Applications] krita | Reporter: | acc4commissions |
| Component: | * Unknown | Assignee: | Krita Bugs <krita-bugs-null> |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | dimula73, emmetoneill.pdx |
| Priority: | NOR | ||
| Version First Reported In: | nightly build (please specify the git hash!) | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | All | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
acc4commissions
2024-09-21 13:06:35 UTC
Oddly, it happens in 5.2.6 too. I can confirm the issue. The problem happens with these brush presets: https://krita-artists.org/t/memileo-impasto-brushes/92952 The reason: The presets have a huge texture and a huge brush in the PNG's metadata area saved as base64+XML. So, every time we load the resource (even when this resource is already present in the database), Krita has to: 1) Decompress the metadata block with "inflate" algorithm. It basically, decompresses a chunk that is already compressed and base64 encoded. 2) Iterate through this XML document with huge CDATA sections. We have multiple solutions for the problem: 1) Just don't save "embedded resources" within the preset, when the preset is saved into a bundle (since bundle also includes them when saving) 2) Save the embedded resources in a separate PNG-metadata section * the main "preset" section should still contain the metadata of the embedded resources, but shouldn't contain the CDATA section. * the CDATA sections should be stored in a separate PNG-metadata section that is loaded only when needed 3) Do not use QImageBuilder and use libpng directly to disable compression on that extra PNG-metadata section (sounds a bit too much) > 2) Save the embedded resources in a separate PNG-metadata section
> * the main "preset" section should still contain the metadata of the embedded resources, but shouldn't contain the CDATA section.
> * the CDATA sections should be stored in a separate PNG-metadata section that is loaded only when needed
To expand on this idea, maybe we could store a much smaller version of the embedded textures with the preset, which can be loaded quickly, only to swap over to the full-size larger texture after it finishes loading the background.
Kind of like the mipmap / level-of-detail system that modern game engines use to speed up asset load times.
|