author | alwin <alwin> | 2004-04-07 20:28:21 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-07 20:28:21 (UTC) |
commit | 52ccc71e2859ae9d738629249baeef3e3df992a2 (patch) (unidiff) | |
tree | 7315f7b6810cb246296fea30e35c4f1205be97f3 /noncore/graphics/opie-eye/gui/imagescrollview.cpp | |
parent | f8e633dea182beabbb665a25136b43a9dd7d0558 (diff) | |
download | opie-52ccc71e2859ae9d738629249baeef3e3df992a2.zip opie-52ccc71e2859ae9d738629249baeef3e3df992a2.tar.gz opie-52ccc71e2859ae9d738629249baeef3e3df992a2.tar.bz2 |
speed up painting a lot - drawing QImage seems to be a real bad idea.
Painting QPixmap instead.
Diffstat (limited to 'noncore/graphics/opie-eye/gui/imagescrollview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/imagescrollview.cpp | 30 |
1 files changed, 19 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 | |||
@@ -19,4 +19,6 @@ ImageScrollView::ImageScrollView (const QImage&img, QWidget * parent, const char | |||
19 | rotate_to_fit(rfit),first_resize_done(false),m_lastName("") | 19 | rotate_to_fit(rfit),first_resize_done(false),m_lastName("") |
20 | { | 20 | { |
21 | _original_data.convertDepth(QPixmap::defaultDepth()); | ||
22 | _original_data.setAlphaBuffer(false); | ||
21 | init(); | 23 | init(); |
22 | } | 24 | } |
@@ -34,4 +36,6 @@ void ImageScrollView::setImage(const QImage&img) | |||
34 | _image_data = QImage(); | 36 | _image_data = QImage(); |
35 | _original_data=img; | 37 | _original_data=img; |
38 | _original_data.convertDepth(QPixmap::defaultDepth()); | ||
39 | _original_data.setAlphaBuffer(false); | ||
36 | m_lastName = ""; | 40 | m_lastName = ""; |
37 | if (first_resize_done) { | 41 | if (first_resize_done) { |
@@ -45,4 +49,6 @@ void ImageScrollView::setImage( const QString& path ) { | |||
45 | m_lastName = path; | 49 | m_lastName = path; |
46 | _original_data.load(path); | 50 | _original_data.load(path); |
51 | _original_data.convertDepth(QPixmap::defaultDepth()); | ||
52 | _original_data.setAlphaBuffer(false); | ||
47 | _image_data = QImage(); | 53 | _image_data = QImage(); |
48 | if (first_resize_done) { | 54 | if (first_resize_done) { |
@@ -245,4 +251,6 @@ void ImageScrollView::generateImage() | |||
245 | resizeContents(_image_data.width(),_image_data.height()); | 251 | resizeContents(_image_data.width(),_image_data.height()); |
246 | } | 252 | } |
253 | _pdata.convertFromImage(_image_data); | ||
254 | _image_data=QImage(); | ||
247 | } | 255 | } |
248 | 256 | ||
@@ -286,26 +294,26 @@ void ImageScrollView::drawContents(QPainter * p, int clipx, int clipy, int clipw | |||
286 | bool erase = false; | 294 | bool erase = false; |
287 | 295 | ||
288 | if (!_image_data.size().isValid()) { | 296 | if (!_pdata.size().isValid()) { |
289 | p->fillRect(clipx,clipy,clipw,cliph,white); | 297 | p->fillRect(clipx,clipy,clipw,cliph,white); |
290 | return; | 298 | return; |
291 | } | 299 | } |
292 | if (w>_image_data.width()) { | 300 | if (w>_pdata.width()) { |
293 | w=_image_data.width(); | 301 | w=_pdata.width(); |
294 | x = 0; | 302 | x = 0; |
295 | erase = true; | 303 | erase = true; |
296 | } else if (x+w>_image_data.width()){ | 304 | } else if (x+w>_pdata.width()){ |
297 | x = _image_data.width()-w; | 305 | x = _pdata.width()-w; |
298 | } | 306 | } |
299 | if (h>_image_data.height()) { | 307 | if (h>_pdata.height()) { |
300 | h=_image_data.height(); | 308 | h=_pdata.height(); |
301 | y = 0; | 309 | y = 0; |
302 | erase = true; | 310 | erase = true; |
303 | } else if (y+h>_image_data.height()){ | 311 | } else if (y+h>_pdata.height()){ |
304 | y = _image_data.height()-h; | 312 | y = _pdata.height()-h; |
305 | } | 313 | } |
306 | if (erase||_image_data.hasAlphaBuffer()) { | 314 | if (erase||_original_data.hasAlphaBuffer()) { |
307 | p->fillRect(clipx,clipy,clipw,cliph,white); | 315 | p->fillRect(clipx,clipy,clipw,cliph,white); |
308 | } | 316 | } |
309 | p->drawImage(clipx,clipy,_image_data,x,y,w,h); | 317 | p->drawPixmap(clipx,clipy,_pdata,x,y,w,h); |
310 | } | 318 | } |
311 | 319 | ||