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
This commit is contained in:
Rogier 2015-02-14 15:56:15 +01:00
parent 784cf9604f
commit 59bae48fc7

View File

@ -213,7 +213,16 @@ void PixelAttribute::add(const PixelAttribute &p)
m_b *= m_a; m_b *= m_a;
m_n = 1; 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_r += p.m_r * p.m_a;
m_g += p.m_g * p.m_a; m_g += p.m_g * p.m_a;
m_b += p.m_b * p.m_a; m_b += p.m_b * p.m_a;