From 59bae48fc7d456a33b8c02a48035ce6de80ef8e7 Mon Sep 17 00:00:00 2001 From: Rogier Date: Sat, 14 Feb 2015 15:56:15 +0100 Subject: [PATCH] Fix add method for pixel When adding any pixel to an object in 'invalid' state, the operation should be equivalent to an assignment. It wasn't --- PixelAttributes.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/PixelAttributes.cpp b/PixelAttributes.cpp index fc58ecd..101af75 100644 --- a/PixelAttributes.cpp +++ b/PixelAttributes.cpp @@ -213,7 +213,16 @@ void PixelAttribute::add(const PixelAttribute &p) m_b *= m_a; m_n = 1; } - if (!p.m_n) { + if (!is_valid()) { + m_r = p.m_r; + m_g = p.m_g; + m_b = p.m_b; + m_a = p.m_a; + m_t = 0; + m_h = p.m_h; + m_n = p.m_n; + } + else if (!p.m_n) { m_r += p.m_r * p.m_a; m_g += p.m_g * p.m_a; m_b += p.m_b * p.m_a;