https://bugs.kde.org/show_bug.cgi?id=487866
Dmitry Kazakov <dimul...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|CONFIRMED |RESOLVED Resolution|--- |FIXED Latest Commit| |https://invent.kde.org/grap | |hics/krita/-/commit/0724605 | |60b704e9ab36f488b35081bf49c | |7b9edd --- Comment #3 from Dmitry Kazakov <dimul...@gmail.com> --- Git commit 072460560b704e9ab36f488b35081bf49c7b9edd by Dmitry Kazakov. Committed on 24/10/2024 at 11:27. Pushed by dkazakov into branch 'master'. Fix loading .kpp files with embedded top-level resources The patch fixes multiple issues with loading embedded (side-loaded) resources from the .kpp files: 1) Side-loaded resources were **never** loaded (since the very beginning of 5.0), because `reader.text("embedded_resources").toInt()` was read from a wrong place. The number of resources is stored in XML data, not in the PNG's metadata field. Now Krita doesn't check the resource count at all and just iterates over the XML to find "resource" elements. 2) A new KoResource::sideLoadedResources() method is introduced. It returns a one-time- available resources which are loaded alongside the main resource. These side-loaded resources can be expelled from memory by calling clearSideLoadedResources(), which is called by KisResourceLocator right after loading the resources into the memory. 3) KisResourceLocator now calls loadRequiredResources() in all code paths that load the resource into memory (to make sure all its embedded resources are loaded). Previously it required a Krita restart to load the embedded resources, cause it happened only during the normal lazy-loading. 4) Fixed KisEmbeddedTextureData::loadLinkedPattern() to return FailedLink resource instead of invalid EmbeddedResource, when the actual "patternBase64" tag is missing (it is missing in 5.0 version of the presets) 5) Adds a unittest that checks all these peculiarities (see KisPaintOpPresetTest) NOTE: Bug 456197 is "kind of fixed" with this patch, because side-loaded resources are now loaded correctly. Though the problem may still be valid for other resource types that do not side-load the dependencies. Related: bug 456586, bug 456197 M +50 -30 libs/image/brushengine/kis_paintop_preset.cpp M +3 -0 libs/image/brushengine/kis_paintop_preset.h M +1 -0 libs/image/tests/CMakeLists.txt A +108 -0 libs/image/tests/KisPaintOpPresetTest.cpp [License: GPL(v2.0+)] A +21 -0 libs/image/tests/KisPaintOpPresetTest.h [License: GPL(v2.0+)] A +- -- libs/image/tests/data/test-embedded-resources-2.2.kpp A +- -- libs/image/tests/data/test-embedded-resources-5.0.kpp M +39 -21 libs/resources/KisResourceLocator.cpp M +17 -0 libs/resources/KoResource.cpp M +28 -0 libs/resources/KoResource.h M +6 -1 plugins/paintops/libpaintop/KisEmbeddedTextureData.cpp https://invent.kde.org/graphics/krita/-/commit/072460560b704e9ab36f488b35081bf49c7b9edd -- You are receiving this mail because: You are watching all bug changes.