Commit 847af4a6 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Fix assert with palettize filter and multi-group palettes.

This was not a good use of an assert, especially as there was no
way to check if the swatch is there without having access to the group,
which is also what this function searches for...
parent 9a4294b9
......@@ -291,6 +291,7 @@ void KoColorSet::clear()
KisSwatch KoColorSet::getColorGlobal(quint32 x, quint32 y) const
{
int yInGroup = y;
KisSwatch e;
QString nameGroupFoundIn;
for (const QString &groupName : d->groupNames) {
if (yInGroup < d->groups[groupName].rowCount()) {
......@@ -300,10 +301,14 @@ KisSwatch KoColorSet::getColorGlobal(quint32 x, quint32 y) const
yInGroup -= d->groups[groupName].rowCount();
}
}
const KisSwatchGroup &groupFoundIn = nameGroupFoundIn == GLOBAL_GROUP_NAME
? d->global() : d->groups[nameGroupFoundIn];
Q_ASSERT(groupFoundIn.checkEntry(x, yInGroup));
return groupFoundIn.getEntry(x, yInGroup);
KisSwatchGroup &groupFoundIn = d->global();
if (nameGroupFoundIn != GLOBAL_GROUP_NAME) {
groupFoundIn = d->groups[nameGroupFoundIn];
}
if (groupFoundIn.checkEntry(x, yInGroup)) {
e = groupFoundIn.getEntry(x, yInGroup);
}
return e;
}
KisSwatch KoColorSet::getColorGroup(quint32 x, quint32 y, QString groupName)
......
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