Commit 2153f3ba authored by Boudewijn Rempt's avatar Boudewijn Rempt

Fix the posterize filter to use normal gamma, like it was designed for

BACKPORT:krita/4.2
parent af983195
......@@ -89,8 +89,20 @@ void KisPosterizeColorTransformation::transform(const quint8* src, quint8* dst,
{
quint16 m_rgba[4];
quint16 m_mod[4];
KoColorConversionTransformation* t =
KoColorSpaceRegistry::instance()->createColorConverter(m_colorSpace,
KoColorSpaceRegistry::instance()->rgb16("sRGB-elle-V2-srgbtrc.icc"),
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
KoColorConversionTransformation* b =
KoColorSpaceRegistry::instance()->createColorConverter(
KoColorSpaceRegistry::instance()->rgb16("sRGB-elle-V2-srgbtrc.icc"),
m_colorSpace,
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
while (nPixels--) {
m_colorSpace->toRgbA16(src, reinterpret_cast<quint8 *>(m_rgba), 1);
t->transform(src, reinterpret_cast<quint8 *>(m_rgba), 1);
m_mod[0] = m_rgba[0] % m_step;
m_mod[1] = m_rgba[1] % m_step;
......@@ -102,7 +114,7 @@ void KisPosterizeColorTransformation::transform(const quint8* src, quint8* dst,
m_rgba[2] = m_rgba[2] + (m_mod[2] > m_halfStep ? m_step - m_mod[2] : -m_mod[2]);
m_rgba[3] = m_rgba[3] + (m_mod[3] > m_halfStep ? m_step - m_mod[3] : -m_mod[3]);
m_colorSpace->fromRgbA16(reinterpret_cast<quint8 *>(m_rgba), dst, 1);
b->transform(reinterpret_cast<quint8 *>(m_rgba), dst, 1);
src += m_psize;
dst += m_psize;
}
......
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