From 16f991e2ed3ec37f41a4e49623d986856907c89c Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Wed, 9 May 2012 22:50:48 -0300 Subject: [PATCH] fix float precision issue for comparing colors --- src/framework/math/color.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/framework/math/color.h b/src/framework/math/color.h index e23cb7b9..be3960ea 100644 --- a/src/framework/math/color.h +++ b/src/framework/math/color.h @@ -65,8 +65,8 @@ public: bool operator==(uint32_t rgba) const { return this->rgba() == rgba; } Color& operator=(const Color& other) { m_r = other.m_r; m_g = other.m_g; m_b = other.m_b; m_a = other.m_a; return *this; } - bool operator==(const Color& other) const { return other.m_r == m_r && other.m_g == m_g && other.m_b == m_b && other.m_a == m_a; } - bool operator!=(const Color& other) const { return other.m_r != m_r || other.m_g != m_g || other.m_b != m_b || other.m_a != m_a; } + bool operator==(const Color& other) const { return other.rgba() == rgba(); } + bool operator!=(const Color& other) const { return other.rgba() != rgba(); } static Color from8bit(int color) { if(color >= 216 || color <= 0)