Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Don't clamp colors to unitValue in the 32bit float specialization of the copy blending mode.
Wolthera van Hövell tot Westerfliera301f4ff4e29
diff --git a/libs/pigment/compositeops/KoOptimizedCompositeOpCopy128.h b/libs/pigment/compositeops/KoOptimizedCompositeOpCopy128.hindex c714da84c3..e6cb39799a 100644--- a/libs/pigment/compositeops/KoOptimizedCompositeOpCopy128.h+++ b/libs/pigment/compositeops/KoOptimizedCompositeOpCopy128.h@@ -116,13 +116,13 @@ struct CopyCompositor128 {dst_c3 /= newAlpha;- const float_v unitValue(KoColorSpaceMathsTraits<channels_type>::unitValue);- dst_c1 = xsimd::select(xsimd::isnan(dst_c1), unitValue, dst_c1);- dst_c2 = xsimd::select(xsimd::isnan(dst_c2), unitValue, dst_c2);- dst_c3 = xsimd::select(xsimd::isnan(dst_c3), unitValue, dst_c3);- dst_c1 = xsimd::min(dst_c1, unitValue);- dst_c2 = xsimd::min(dst_c2, unitValue);- dst_c3 = xsimd::min(dst_c3, unitValue);+ const float_v maxValue(KoColorSpaceMathsTraits<channels_type>::max);+ dst_c1 = xsimd::select(xsimd::isnan(dst_c1), maxValue, dst_c1);+ dst_c2 = xsimd::select(xsimd::isnan(dst_c2), maxValue, dst_c2);+ dst_c3 = xsimd::select(xsimd::isnan(dst_c3), maxValue, dst_c3);+ dst_c1 = xsimd::min(dst_c1, maxValue);+ dst_c2 = xsimd::min(dst_c2, maxValue);+ dst_c3 = xsimd::min(dst_c3, maxValue);}/**@@ -236,15 +236,15 @@ struct CopyCompositor128 {dst_c2 /= newAlpha;dst_c3 /= newAlpha;- const float unitValue = KoColorSpaceMathsTraits<channels_type>::unitValue;+ const float maxValue = KoColorSpaceMathsTraits<channels_type>::max;- dst_c1 = std::isnan(dst_c1) ? unitValue : dst_c1;- dst_c2 = std::isnan(dst_c2) ? unitValue : dst_c2;- dst_c3 = std::isnan(dst_c3) ? unitValue : dst_c3;+ dst_c1 = std::isnan(dst_c1) ? maxValue : dst_c1;+ dst_c2 = std::isnan(dst_c2) ? maxValue : dst_c2;+ dst_c3 = std::isnan(dst_c3) ? maxValue : dst_c3;- dst_c1 = std::min(dst_c1, unitValue);- dst_c2 = std::min(dst_c2, unitValue);- dst_c3 = std::min(dst_c3, unitValue);+ dst_c1 = std::min(dst_c1, maxValue);+ dst_c2 = std::min(dst_c2, maxValue);+ dst_c3 = std::min(dst_c3, maxValue);}if (allChannelsFlag) {