|
|
| |
const int sw = m_dst.width(); | const int sw = m_dst.width(); |
const int sh = m_dst.height(); | const int sh = m_dst.height(); |
const int bpl = m_dst.bytesPerLine(); |
|
switch(m_dst.depth()) { | switch(m_dst.depth()) { |
case 32: | case 32: |
{ | { |
uchar *mixed_data = m_tmp.bits(); |
|
const uchar *back_data = m_src.bits(); |
|
const uchar *front_data = m_dst.bits(); |
|
|
|
for (int sy = 0; sy < sh; sy++) { | for (int sy = 0; sy < sh; sy++) { |
quint32* mixed = (quint32*)mixed_data; |
|
const quint32* back = (const quint32*)back_data; |
|
const quint32* front = (const quint32*)front_data; |
|
for (int sx = 0; sx < sw; sx++) { | for (int sx = 0; sx < sw; sx++) { |
quint32 bp = back[sx]; |
if(!m_src.valid(sx, sy)) { |
quint32 fp = front[sx]; |
qDebug() << "Source image borked, giving up fade effect."; |
|
m_fadeTimer->stop(); |
mixed[sx] = qRgb((qRed(bp)*ia + qRed(fp)*a)>>8, |
emit fadeProgress( QPixmap::fromImage( m_dst ) ); |
(qGreen(bp)*ia + qGreen(fp)*a)>>8, |
return; |
(qBlue(bp)*ia + qBlue(fp)*a)>>8); |
} |
|
QRgb bp = m_src.pixel(sx, sy); |
|
QRgb fp = m_dst.pixel(sx, sy); |
|
|
|
m_tmp.setPixel(sx, sy, |
|
qRgb( (qRed(bp)*ia + qRed(fp)*a)>>8, |
|
(qGreen(bp)*ia + qGreen(fp)*a)>>8, |
|
(qBlue(bp)*ia + qBlue(fp)*a)>>8 |
|
) |
|
); |
} | } |
mixed_data += bpl; |
|
back_data += bpl; |
|
front_data += bpl; |
|
} | } |
} | } |
default: | default: |