From 62aac7d384c5754fb3455e4b39d462a1398d74f8 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 7 Jan 2014 12:52:12 +0000 Subject: [PATCH] Adjusted mapping of float->int colour values (again). --- modules/juce_graphics/colour/juce_Colour.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/juce_graphics/colour/juce_Colour.cpp b/modules/juce_graphics/colour/juce_Colour.cpp index 575e7dfc5b..0646287eb4 100644 --- a/modules/juce_graphics/colour/juce_Colour.cpp +++ b/modules/juce_graphics/colour/juce_Colour.cpp @@ -26,8 +26,7 @@ namespace ColourHelpers { static uint8 floatToUInt8 (const float n) noexcept { - // the multiplier has a small extra amount to allow for FP rounding errors. - return n <= 0.0f ? 0 : (n >= 1.0f ? 255 : (uint8) (n * 255.1f)); + return n <= 0.0f ? 0 : (n >= 1.0f ? 255 : static_cast (n * 255.996f)); } // This is an adjusted brightness value, based on the way the human