comparison Core/Images/PixelTraits.h @ 3263:f58553a98204

fix rounding
author am@osimis.io
date Wed, 20 Feb 2019 12:34:22 +0100
parents 4e43e67f8ecf
children 94f4a18a79cc
comparison
equal deleted inserted replaced
3260:345f86fd1ac3 3263:f58553a98204
101 101
102 ORTHANC_FORCE_INLINE 102 ORTHANC_FORCE_INLINE
103 static void FloatToPixel(PixelType& target, 103 static void FloatToPixel(PixelType& target,
104 float value) 104 float value)
105 { 105 {
106 value += 0.5f;
106 if (value < static_cast<float>(std::numeric_limits<PixelType>::min())) 107 if (value < static_cast<float>(std::numeric_limits<PixelType>::min()))
107 { 108 {
108 target = std::numeric_limits<PixelType>::min(); 109 target = std::numeric_limits<PixelType>::min();
109 } 110 }
110 else if (value > static_cast<float>(std::numeric_limits<PixelType>::max())) 111 else if (value > static_cast<float>(std::numeric_limits<PixelType>::max()))