author | alwin <alwin> | 2004-04-16 20:33:55 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-16 20:33:55 (UTC) |
commit | cc56768485c3785439883dd1c456493f7ece2d84 (patch) (unidiff) | |
tree | 8ab6ff6feae6f2cc9cb73b4eaf8215cdd0d53a0d /libopie2 | |
parent | 7dc52619640437ec448ea3bccdf924ea9a29bfa6 (diff) | |
download | opie-cc56768485c3785439883dd1c456493f7ece2d84.zip opie-cc56768485c3785439883dd1c456493f7ece2d84.tar.gz opie-cc56768485c3785439883dd1c456493f7ece2d84.tar.bz2 |
fixed painting problems when reloading images when widget is visible
-rw-r--r-- | libopie2/opiemm/oimagescrollview.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libopie2/opiemm/oimagescrollview.cpp b/libopie2/opiemm/oimagescrollview.cpp index 61b2062..a8165a4 100644 --- a/libopie2/opiemm/oimagescrollview.cpp +++ b/libopie2/opiemm/oimagescrollview.cpp | |||
@@ -157,7 +157,7 @@ void OImageScrollView::init() | |||
157 | connect(this,SIGNAL(viewportSizeChanged(const QSize&)), | 157 | connect(this,SIGNAL(viewportSizeChanged(const QSize&)), |
158 | _zoomer, SLOT(setViewPortSize(const QSize&)) ); | 158 | _zoomer, SLOT(setViewPortSize(const QSize&)) ); |
159 | 159 | ||
160 | viewport()->setBackgroundColor(white); | 160 | setBackgroundColor(white); |
161 | setFocusPolicy(QWidget::StrongFocus); | 161 | setFocusPolicy(QWidget::StrongFocus); |
162 | setImageScaledLoaded(false); | 162 | setImageScaledLoaded(false); |
163 | setImageIsJpeg(false); | 163 | setImageIsJpeg(false); |
@@ -351,7 +351,7 @@ void OImageScrollView::generateImage() | |||
351 | if (AutoRotate()) r = Rotate90; | 351 | if (AutoRotate()) r = Rotate90; |
352 | } | 352 | } |
353 | 353 | ||
354 | 354 | int twidth,theight; | |
355 | odebug << " r = " << r << oendl; | 355 | odebug << " r = " << r << oendl; |
356 | if (AutoScale() && (_original_data.width()>width() || _original_data.height() > height()) ) { | 356 | if (AutoScale() && (_original_data.width()>width() || _original_data.height() > height()) ) { |
357 | if (!_image_data.size().isValid()||width()>_image_data.width()||height()>_image_data.height()) { | 357 | if (!_image_data.size().isValid()||width()>_image_data.width()||height()>_image_data.height()) { |
@@ -363,7 +363,6 @@ void OImageScrollView::generateImage() | |||
363 | } | 363 | } |
364 | } | 364 | } |
365 | rescaleImage(width(),height()); | 365 | rescaleImage(width(),height()); |
366 | resizeContents(_image_data.width(),_image_data.height()); | ||
367 | } else if (!FirstResizeDone()||r!=m_last_rot||_image_data.width()==0) { | 366 | } else if (!FirstResizeDone()||r!=m_last_rot||_image_data.width()==0) { |
368 | if (r==Rotate0) { | 367 | if (r==Rotate0) { |
369 | _image_data = _original_data; | 368 | _image_data = _original_data; |
@@ -371,9 +370,10 @@ void OImageScrollView::generateImage() | |||
371 | rotate_into_data(r); | 370 | rotate_into_data(r); |
372 | } | 371 | } |
373 | m_last_rot = r; | 372 | m_last_rot = r; |
374 | resizeContents(_image_data.width(),_image_data.height()); | ||
375 | } | 373 | } |
376 | _pdata.convertFromImage(_image_data); | 374 | _pdata.convertFromImage(_image_data); |
375 | twidth = _image_data.width(); | ||
376 | theight = _image_data.height(); | ||
377 | 377 | ||
378 | /* | 378 | /* |
379 | * update the zoomer | 379 | * update the zoomer |
@@ -381,6 +381,7 @@ void OImageScrollView::generateImage() | |||
381 | check_zoomer(); | 381 | check_zoomer(); |
382 | emit imageSizeChanged( _image_data.size() ); | 382 | emit imageSizeChanged( _image_data.size() ); |
383 | rescaleImage( 128, 128 ); | 383 | rescaleImage( 128, 128 ); |
384 | resizeContents(twidth,theight); | ||
384 | /* | 385 | /* |
385 | * move scrollbar | 386 | * move scrollbar |
386 | */ | 387 | */ |
@@ -393,6 +394,9 @@ void OImageScrollView::generateImage() | |||
393 | * invalidate | 394 | * invalidate |
394 | */ | 395 | */ |
395 | _image_data=QImage(); | 396 | _image_data=QImage(); |
397 | if (isVisible()) { | ||
398 | updateContents(contentsX(),contentsY(),width(),height()); | ||
399 | } | ||
396 | } | 400 | } |
397 | 401 | ||
398 | void OImageScrollView::resizeEvent(QResizeEvent * e) | 402 | void OImageScrollView::resizeEvent(QResizeEvent * e) |
@@ -437,7 +441,7 @@ void OImageScrollView::drawContents(QPainter * p, int clipx, int clipy, int clip | |||
437 | bool erase = false; | 441 | bool erase = false; |
438 | 442 | ||
439 | if (!_pdata.size().isValid()) { | 443 | if (!_pdata.size().isValid()) { |
440 | p->fillRect(clipx,clipy,clipw,cliph,white); | 444 | p->fillRect(clipx,clipy,clipw,cliph, backgroundColor()); |
441 | return; | 445 | return; |
442 | } | 446 | } |
443 | if (w>_pdata.width()) { | 447 | if (w>_pdata.width()) { |
@@ -455,7 +459,7 @@ void OImageScrollView::drawContents(QPainter * p, int clipx, int clipy, int clip | |||
455 | y = _pdata.height()-h; | 459 | y = _pdata.height()-h; |
456 | } | 460 | } |
457 | if (erase||_original_data.hasAlphaBuffer()) { | 461 | if (erase||_original_data.hasAlphaBuffer()) { |
458 | p->fillRect(clipx,clipy,clipw,cliph,white); | 462 | p->fillRect(clipx,clipy,clipw,cliph, backgroundColor()); |
459 | } | 463 | } |
460 | p->drawPixmap(clipx,clipy,_pdata,x,y,w,h); | 464 | p->drawPixmap(clipx,clipy,_pdata,x,y,w,h); |
461 | } | 465 | } |