Commit e2eb1356 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix profile when loading image with non-default profiles

It looks like the image's profile may be initialized on some
earlier stages, so we should check if the profile is already set
on layers a bit earlier.

BUG:413993
parent 5a5c78cb
......@@ -1263,9 +1263,21 @@ bool KisImage::assignLayerProfile(KisNodeSP node, const KoColorProfile *profile)
bool KisImage::assignImageProfile(const KoColorProfile *profile, bool blockAllUpdates)
{
if (!profile) return false;
const KoColorSpace *srcColorSpace = m_d->colorSpace;
bool imageProfileIsSame = *srcColorSpace->profile() == *profile;
if (!profile || *srcColorSpace->profile() == *profile) return false;
imageProfileIsSame &=
!KisLayerUtils::recursiveFindNode(m_d->rootLayer,
[profile] (KisNodeSP node) {
return *node->colorSpace()->profile() != *profile;
});
if (imageProfileIsSame) {
dbgImage << "Trying to set the same image profile again" << ppVar(srcColorSpace->profile()->name()) << ppVar(profile->name());
return true;
}
KUndo2MagicString actionName = kundo2_i18n("Assign Profile");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment