[Kst] extragear/graphics/kst/kst
Andrew Walker
arwalker at sumusltd.com
Tue Aug 16 22:24:16 CEST 2005
SVN commit 449833 by arwalker:
Don't try drawing to a zero-size pixmap.
M +17 -14 kstviewpicture.cpp
--- trunk/extragear/graphics/kst/kst/kstviewpicture.cpp #449832:449833
@@ -76,23 +76,26 @@
p.drawLine(geometry().topRight(), geometry().bottomLeft());
} else {
QRect cr = contentsRect();
- if (_iCache.isNull() || _iCache.size() != cr.size()) {
- _iCache = _image.copy();
+
+ if (cr.size().width() > 0 && cr.size().height() > 0 ) {
+ if (_iCache.isNull() || _iCache.size() != cr.size()) {
+ _iCache = _image.copy();
+ if (!_iCache.isNull()) {
+ _iCache = _iCache.smoothScale(cr.size());
+ }
+ }
if (!_iCache.isNull()) {
- _iCache = _iCache.smoothScale(cr.size());
- }
- }
- if (!_iCache.isNull()) {
- if (p.rasterOp() == Qt::SetROP) { // HACK!! we look for depth=1
- // which indicates clipping / BW mode
- if (_iCache.hasAlphaBuffer()) {
- p.drawImage(contentsRect().topLeft(), _iCache.createAlphaMask());
+ if (p.rasterOp() == Qt::SetROP) { // HACK!! we look for depth=1
+ // which indicates clipping / BW mode
+ if (_iCache.hasAlphaBuffer()) {
+ p.drawImage(contentsRect().topLeft(), _iCache.createAlphaMask());
+ } else {
+ p.setBrush(Qt::color0);
+ p.drawRect(contentsRect());
+ }
} else {
- p.setBrush(Qt::color0);
- p.drawRect(contentsRect());
+ p.drawImage(contentsRect().topLeft(), _iCache);
}
- } else {
- p.drawImage(contentsRect().topLeft(), _iCache);
}
}
}
More information about the Kst
mailing list