if from and to dimensions are different, and we return only to, we should anyways do a new pixmap of the from dimension and center to in it.
this resolves the flickering PushButton even tough removes some optimizations svn path=/trunk/KDE/kdelibs/; revision=1064770
This commit is contained in:
parent
fdae3f0d59
commit
3a27e22612
@ -150,18 +150,32 @@ QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
|
||||
|
||||
int value = int(0xff * amount);
|
||||
|
||||
if (value == 0) {
|
||||
return from;
|
||||
} else if (value == 0xff) {
|
||||
return to;
|
||||
//paint to in the center of from
|
||||
QRect toRect = to.rect();
|
||||
toRect.moveCenter(from.rect().center());
|
||||
|
||||
if (from.size() == to.size()) {
|
||||
if (value == 0) {
|
||||
return from;
|
||||
} else if (value == 0xff) {
|
||||
return to;
|
||||
}
|
||||
} else {
|
||||
if (value == 0) {
|
||||
return from;
|
||||
} else if (value == 0xff) {
|
||||
QPixmap result(from.size());
|
||||
result.fill(Qt::transparent);
|
||||
QPainter p(&result);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
p.drawPixmap(toRect.topLeft(), to);
|
||||
p.end();
|
||||
}
|
||||
}
|
||||
|
||||
QColor color;
|
||||
color.setAlphaF(amount);
|
||||
|
||||
//paint to in the center of from
|
||||
QRect toRect = to.rect();
|
||||
toRect.moveCenter(from.rect().center());
|
||||
|
||||
// If the native paint engine supports Porter/Duff compositing and CompositionMode_Plus
|
||||
if (from.paintEngine()->hasFeature(QPaintEngine::PorterDuff) &&
|
||||
|
Loading…
Reference in New Issue
Block a user