use qfuzzycompare to resolse black frame in pixmap transitions

svn path=/trunk/KDE/kdelibs/; revision=1095410
This commit is contained in:
Igor Trindade Oliveira 2010-02-24 08:53:10 +00:00
parent a6548f2ee0
commit 65ee24a2a3

View File

@ -144,16 +144,19 @@ void PixmapTransition::updateCurrentTime(int currentTime)
if (m_currentPixmap.isNull()) { if (m_currentPixmap.isNull()) {
m_currentPixmap = QPixmap(m_targetPixmap.size()); m_currentPixmap = QPixmap(m_targetPixmap.size());
} }
m_currentPixmap.fill(QColor(0, 0, 0, (int)(((qreal)255)*qMin((qreal)0.98, delta)))); m_currentPixmap.fill(QColor(0, 0, 0, (int)(((qreal)255)*delta)));
QPainter p(&m_currentPixmap); QPainter p(&m_currentPixmap);
p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.setCompositionMode(QPainter::CompositionMode_SourceIn);
p.drawPixmap(m_currentPixmap.rect(), m_targetPixmap, m_targetPixmap.rect()); p.drawPixmap(m_currentPixmap.rect(), m_targetPixmap, m_targetPixmap.rect());
p.end(); p.end();
} else if (m_targetPixmap.isNull()) { } else if (m_targetPixmap.isNull()) {
m_currentPixmap = m_startPixmap; m_currentPixmap = m_startPixmap;
if (qFuzzyCompare(delta, qreal(1.0))) {
return;
}
QPainter p(&m_currentPixmap); QPainter p(&m_currentPixmap);
p.setCompositionMode(QPainter::CompositionMode_DestinationIn); p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
p.fillRect(m_currentPixmap.rect(), QColor(0, 0, 0, (int)(((qreal)255)*qMin((qreal)0.98, delta)))); p.fillRect(m_currentPixmap.rect(), QColor(0, 0, 0, (int)(((qreal)255)*delta)));
p.end(); p.end();
} }
} }