summaryrefslogtreecommitdiff
path: root/libopie2
authoralwin <alwin>2004-04-15 16:16:47 (UTC)
committer alwin <alwin>2004-04-15 16:16:47 (UTC)
commitaa0fce09fc2df5427c43b6a5f0539e725aad2828 (patch) (unidiff)
treeee9cd98bed9222fa994d89cab76a2f515b2cd45b /libopie2
parenta002be54e33d64e69c7edf2960d5e68a9a0609e4 (diff)
downloadopie-aa0fce09fc2df5427c43b6a5f0539e725aad2828.zip
opie-aa0fce09fc2df5427c43b6a5f0539e725aad2828.tar.gz
opie-aa0fce09fc2df5427c43b6a5f0539e725aad2828.tar.bz2
hopefull better repainting when switching the image while view is
visible
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiemm/oimagescrollview.cpp30
1 files changed, 11 insertions, 19 deletions
diff --git a/libopie2/opiemm/oimagescrollview.cpp b/libopie2/opiemm/oimagescrollview.cpp
index 68b06af..30a8fba 100644
--- a/libopie2/opiemm/oimagescrollview.cpp
+++ b/libopie2/opiemm/oimagescrollview.cpp
@@ -97,5 +97,5 @@ void OImageScrollView::loadJpeg(bool interncall)
97 hei = wid; 97 hei = wid;
98 } 98 }
99 param = QString( "Fast Shrink( 3 ) Scale( %1, %2, ScaleFree)" ).arg( wid ).arg( hei ); 99 param = QString( "Fast Shrink( 3 ) Scale( %1, %2, ScaleMin)" ).arg( wid ).arg( hei );
100 odebug << "Load jpeg scaled \"" << param << "\"" << oendl; 100 odebug << "Load jpeg scaled \"" << param << "\"" << oendl;
101 iio.setParameters(param.latin1()); 101 iio.setParameters(param.latin1());
@@ -126,4 +126,5 @@ void OImageScrollView::setImage( const QString& path ) {
126 if (m_lastName == path) return; 126 if (m_lastName == path) return;
127 m_lastName = path; 127 m_lastName = path;
128 _original_data = QImage();
128 QString itype = QImage::imageFormat(m_lastName); 129 QString itype = QImage::imageFormat(m_lastName);
129 odebug << "Image type = " << itype << oendl; 130 odebug << "Image type = " << itype << oendl;
@@ -147,4 +148,5 @@ void OImageScrollView::setImage( const QString& path ) {
147 if (FirstResizeDone()) { 148 if (FirstResizeDone()) {
148 generateImage(); 149 generateImage();
150 if (isVisible()) viewport()->repaint(true);
149 } 151 }
150} 152}
@@ -351,5 +353,10 @@ void OImageScrollView::generateImage()
351{ 353{
352 Rotation r = Rotate0; 354 Rotation r = Rotate0;
353 if (_original_data.isNull()) return; 355 _pdata = QPixmap();
356 if (_original_data.isNull()) {
357 emit imageSizeChanged( _image_data.size() );
358 if (_zoomer) _zoomer->setImage( _image_data );
359 return;
360 }
354 { 361 {
355 QCopEnvelope( "QPE/System", "busy()" ); 362 QCopEnvelope( "QPE/System", "busy()" );
@@ -360,6 +367,7 @@ void OImageScrollView::generateImage()
360 } 367 }
361 368
369
362 odebug << " r = " << r << oendl; 370 odebug << " r = " << r << oendl;
363 if (AutoScale()) { 371 if (AutoScale() && (_original_data.width()>width() || _original_data.height() > height()) ) {
364 if (!_image_data.size().isValid()||width()>_image_data.width()||height()>_image_data.height()) { 372 if (!_image_data.size().isValid()||width()>_image_data.width()||height()>_image_data.height()) {
365 odebug << "Rescaling data" << oendl; 373 odebug << "Rescaling data" << oendl;
@@ -383,5 +391,4 @@ void OImageScrollView::generateImage()
383 _pdata.convertFromImage(_image_data); 391 _pdata.convertFromImage(_image_data);
384 392
385
386 /* 393 /*
387 * update the zoomer 394 * update the zoomer
@@ -476,5 +483,4 @@ void OImageScrollView::drawContents(QPainter * p, int clipx, int clipy, int clip
476void OImageScrollView::viewportMouseMoveEvent(QMouseEvent* e) 483void OImageScrollView::viewportMouseMoveEvent(QMouseEvent* e)
477{ 484{
478 odebug << "Move X and Y " << e->x() << " " << e->y() << oendl;
479 int mx, my; 485 int mx, my;
480 mx = e->x(); 486 mx = e->x();
@@ -483,18 +489,4 @@ void OImageScrollView::viewportMouseMoveEvent(QMouseEvent* e)
483 int diffx = _mouseStartPosX-mx; 489 int diffx = _mouseStartPosX-mx;
484 int diffy = _mouseStartPosY-my; 490 int diffy = _mouseStartPosY-my;
485#if 0
486 QScrollBar*xbar = horizontalScrollBar();
487 QScrollBar*ybar = verticalScrollBar();
488 if (xbar->value()+diffx>xbar->maxValue()) {
489 diffx = xbar->maxValue()-xbar->value();
490 } else if (xbar->value()+diffx<0) {
491 diffx=0-xbar->value();
492 }
493 if (ybar->value()+diffy>ybar->maxValue()) {
494 diffy = ybar->maxValue()-ybar->value();
495 } else if (ybar->value()+diffy<0) {
496 diffy=0-ybar->value();
497 }
498#endif
499 scrollBy(diffx,diffy); 491 scrollBy(diffx,diffy);
500 } 492 }