Skip to content

armgit / krita

Public Imported from GitHub
0

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++

Increase tolerance for is{Zero,Half,Unit}Value for half specializations

Dmitry Kazakov99b9369fea4a
diff --git a/libs/pigment/KoColorSpaceMaths.h b/libs/pigment/KoColorSpaceMaths.h
index 1ad564fdba..05573d2562 100644
--- a/libs/pigment/KoColorSpaceMaths.h
+++ b/libs/pigment/KoColorSpaceMaths.h
@@ -589,34 +589,34 @@ inline half KoColorSpaceMaths<half>::isUnsafeAsDivisor(half value) {
template<>
inline bool KoColorSpaceMaths<half>::isUnitValue(half value) {
- // TODO: check actual constant
- return qAbs(value - KoColorSpaceMathsTraits<half>::unitValue) < 0.0001f;
+ // ~ 2 * HALF_ESPILON
+ return qAbs(value - KoColorSpaceMathsTraits<half>::unitValue) < 0.002f;
}
template<>
inline bool KoColorSpaceMaths<half>::isZeroValue(half value) {
- // TODO: check actual constant
- return qAbs(value) < 0.0001f;
+ // ~ 2 * HALF_ESPILON
+ return qAbs(value) < 0.002f;
}
template<>
inline bool KoColorSpaceMaths<half>::isZeroValueClamped(half f)
{
- // TODO: check actual constant
- return f <= 0.0001f;
+ // ~ 2 * HALF_ESPILON
+ return f <= 0.002f;
}
template<>
inline bool KoColorSpaceMaths<half>::isUnitValueClamped(half f)
{
- // TODO: check actual constant
- return f > 1.0 - 0.0001f;
+ // ~ 2 * HALF_ESPILON
+ return f > 1.0 - 0.002f;
}
template<>
inline bool KoColorSpaceMaths<half>::isHalfValue(half value) {
// TODO: check actual constant
- return qAbs(value - 0.5f) < 0.0001f;
+ return qAbs(value - 0.5f) < 0.001f;
}
#endif