Blur tool: Don't make more transparent pixels with alpha < 255

Regression introduced in f3731c9c282483632301f50c11b1083e09106241 (which
fixed 065ad4f1dca9404e8f66c6a6224dad918e57807c). I think this is the
final version of the blur tool: doesn't make pixels more darker nor
transparent.
This commit is contained in:
David Capello 2019-06-03 21:04:08 -03:00
parent 0e2fcffaa0
commit 2ab27ade9b

View File

@ -378,8 +378,11 @@ public:
m_area.r /= m_area.count;
m_area.g /= m_area.count;
m_area.b /= m_area.count;
m_area.a = (m_area.a/9) * m_opacity / 255;
*m_dstAddress = rgba(m_area.r, m_area.g, m_area.b, m_area.a);
m_area.a /= 9;
*m_dstAddress =
rgba_blender_merge(*m_srcAddress,
rgba(m_area.r, m_area.g, m_area.b, m_area.a),
m_opacity);
}
else {
*m_dstAddress = *m_srcAddress;
@ -424,8 +427,11 @@ public:
if (m_area.count > 0) {
m_area.v /= m_area.count;
m_area.a = (m_area.a/9) * m_opacity / 255;
*m_dstAddress = graya(m_area.v, m_area.a);
m_area.a /= 9;
*m_dstAddress =
graya_blender_merge(*m_srcAddress,
graya(m_area.v, m_area.a),
m_opacity);
}
else {
*m_dstAddress = *m_srcAddress;
@ -475,9 +481,15 @@ public:
m_area.r /= m_area.count;
m_area.g /= m_area.count;
m_area.b /= m_area.count;
m_area.a = (m_area.a/9) * m_opacity / 255;
m_area.a /= 9;
const color_t c =
rgba_blender_merge(m_palette->getEntry(*m_srcAddress),
rgba(m_area.r, m_area.g, m_area.b, m_area.a),
m_opacity);
*m_dstAddress = m_rgbmap->mapColor(
m_area.r, m_area.g, m_area.b, m_area.a);
rgba_getr(c), rgba_getg(c), rgba_getb(c), rgba_geta(c));
}
else {
*m_dstAddress = *m_srcAddress;