the cached pixmap can be invalid, when the panel size is invalid

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=874489
This commit is contained in:
Marco Martin 2008-10-21 18:01:08 +00:00
parent 53c6071fc8
commit ea4c9227bc

View File

@ -334,7 +334,9 @@ QBitmap PanelSvg::mask() const
if (!panel->cachedMask) {
if (panel->cachedBackground.isNull()) {
d->generateBackground(panel);
Q_ASSERT(!panel->cachedBackground.isNull());
if (panel->cachedBackground.isNull()) {
return QBitmap();
}
}
panel->cachedMask = QBitmap(panel->cachedBackground.alphaChannel().createMaskFromColor(Qt::black));
}
@ -375,7 +377,9 @@ QPixmap PanelSvg::panelPixmap()
PanelData *panel = d->panels[d->prefix];
if (panel->cachedBackground.isNull()) {
d->generateBackground(panel);
Q_ASSERT(!panel->cachedBackground.isNull());
if (panel->cachedBackground.isNull()) {
return QPixmap();
}
}
return panel->cachedBackground;
@ -386,7 +390,9 @@ void PanelSvg::paintPanel(QPainter *painter, const QRectF &target, const QRectF
PanelData *panel = d->panels[d->prefix];
if (panel->cachedBackground.isNull()) {
d->generateBackground(panel);
Q_ASSERT(!panel->cachedBackground.isNull());
if (panel->cachedBackground.isNull()) {
return;
}
}
painter->drawPixmap(target, panel->cachedBackground, source.isValid() ? source : target);
@ -397,7 +403,9 @@ void PanelSvg::paintPanel(QPainter *painter, const QPointF &pos)
PanelData *panel = d->panels[d->prefix];
if (panel->cachedBackground.isNull()) {
d->generateBackground(panel);
Q_ASSERT(!panel->cachedBackground.isNull());
if (panel->cachedBackground.isNull()) {
return;
}
}
painter->drawPixmap(pos, panel->cachedBackground);