From d3fd98c8fad7b64e30416d193b47b76908965134 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Fri, 11 Oct 2013 21:37:06 -0400 Subject: [PATCH] Fix Intensity calculation for pixel. --- Base/src/Pixel.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Base/src/Pixel.cpp b/Base/src/Pixel.cpp index c4fcfa9..01582ef 100644 --- a/Base/src/Pixel.cpp +++ b/Base/src/Pixel.cpp @@ -192,11 +192,11 @@ namespace FasTC { float Pixel::ToIntensity() const { // First convert the pixel values to floats using premultiplied alpha... - float a = ConvertChannelToFloat(A(), m_BitDepth[0]); - float r = a * ConvertChannelToFloat(R(), m_BitDepth[1]); - float g = a * ConvertChannelToFloat(G(), m_BitDepth[2]); - float b = a * ConvertChannelToFloat(B(), m_BitDepth[3]); - return r * 0.21f + g * 0.71f + b * 0.07f; + double a = ConvertChannelToFloat(A(), m_BitDepth[0]); + double r = a * ConvertChannelToFloat(R(), m_BitDepth[1]); + double g = a * ConvertChannelToFloat(G(), m_BitDepth[2]); + double b = a * ConvertChannelToFloat(B(), m_BitDepth[3]); + return static_cast(r * 0.2126 + g * 0.7152 + b * 0.0722); } uint32 Pixel::Pack() const {