-rw-r--r-- | noncore/graphics/opie-eye/gui/imagescrollview.cpp | 30 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imagescrollview.h | 2 |
2 files changed, 21 insertions, 11 deletions
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.cpp b/noncore/graphics/opie-eye/gui/imagescrollview.cpp index 98054ff..ad19219 100644 --- a/noncore/graphics/opie-eye/gui/imagescrollview.cpp +++ b/noncore/graphics/opie-eye/gui/imagescrollview.cpp @@ -20,2 +20,4 @@ ImageScrollView::ImageScrollView (const QImage&img, QWidget * parent, const char { + _original_data.convertDepth(QPixmap::defaultDepth()); + _original_data.setAlphaBuffer(false); init(); @@ -35,2 +37,4 @@ void ImageScrollView::setImage(const QImage&img) _original_data=img; + _original_data.convertDepth(QPixmap::defaultDepth()); + _original_data.setAlphaBuffer(false); m_lastName = ""; @@ -46,2 +50,4 @@ void ImageScrollView::setImage( const QString& path ) { _original_data.load(path); + _original_data.convertDepth(QPixmap::defaultDepth()); + _original_data.setAlphaBuffer(false); _image_data = QImage(); @@ -246,2 +252,4 @@ void ImageScrollView::generateImage() } + _pdata.convertFromImage(_image_data); + _image_data=QImage(); } @@ -287,3 +295,3 @@ void ImageScrollView::drawContents(QPainter * p, int clipx, int clipy, int clipw - if (!_image_data.size().isValid()) { + if (!_pdata.size().isValid()) { p->fillRect(clipx,clipy,clipw,cliph,white); @@ -291,20 +299,20 @@ void ImageScrollView::drawContents(QPainter * p, int clipx, int clipy, int clipw } - if (w>_image_data.width()) { - w=_image_data.width(); + if (w>_pdata.width()) { + w=_pdata.width(); x = 0; erase = true; - } else if (x+w>_image_data.width()){ - x = _image_data.width()-w; + } else if (x+w>_pdata.width()){ + x = _pdata.width()-w; } - if (h>_image_data.height()) { - h=_image_data.height(); + if (h>_pdata.height()) { + h=_pdata.height(); y = 0; erase = true; - } else if (y+h>_image_data.height()){ - y = _image_data.height()-h; + } else if (y+h>_pdata.height()){ + y = _pdata.height()-h; } - if (erase||_image_data.hasAlphaBuffer()) { + if (erase||_original_data.hasAlphaBuffer()) { p->fillRect(clipx,clipy,clipw,cliph,white); } - p->drawImage(clipx,clipy,_image_data,x,y,w,h); + p->drawPixmap(clipx,clipy,_pdata,x,y,w,h); } diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.h b/noncore/graphics/opie-eye/gui/imagescrollview.h index 17e2f5f..eb91dbd 100644 --- a/noncore/graphics/opie-eye/gui/imagescrollview.h +++ b/noncore/graphics/opie-eye/gui/imagescrollview.h @@ -5,2 +5,3 @@ #include <qimage.h> +#include <qpixmap.h> #include <qstring.h> @@ -42,2 +43,3 @@ protected: QImage _original_data; + QPixmap _pdata; |