Commit 5282f861 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Do clamping in color space traits properly.

Previous version just didn't work. This fixes the HSL output.

Ref T2438
parent c6119f6d
......@@ -157,8 +157,10 @@ struct KoColorSpaceTrait {
Q_ASSERT((int)values.count() == (int)channels_nb);
channels_type c;
for (uint i = 0; i < channels_nb; i++) {
c = qBound(KoColorSpaceMathsTraits<channels_type>::min,(channels_type)
((float)KoColorSpaceMathsTraits<channels_type>::unitValue * values[i]), KoColorSpaceMathsTraits<channels_type>::max);
float b = qBound((float)KoColorSpaceMathsTraits<channels_type>::min * values[i],
(float)KoColorSpaceMathsTraits<channels_type>::unitValue * values[i],
(float)KoColorSpaceMathsTraits<channels_type>::max * values[i]);
c = (channels_type)b;
nativeArray(pixel)[i] = c;
}
......
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