From 3c7c682e072eb5002869723f8daee2da68a782c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Mon, 16 Apr 2012 20:55:05 +0000 Subject: [PATCH] paysages: Fixed previews for win32. git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@302 b1fd45b6-86a6-48da-8261-f70d1f35bdcc --- gui_qt/basepreview.cpp | 11 +++++++---- gui_qt/basepreview.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gui_qt/basepreview.cpp b/gui_qt/basepreview.cpp index 60b3949..99fc254 100644 --- a/gui_qt/basepreview.cpp +++ b/gui_qt/basepreview.cpp @@ -60,6 +60,7 @@ BasePreview::BasePreview(QWidget* parent) : this->pixbuf->fill(0x00000000); this->alive = true; + this->need_restart = false; this->need_render = true; QObject::connect(this, SIGNAL(contentChange()), this, SLOT(update())); @@ -157,6 +158,7 @@ void BasePreview::handleRedraw() painter.drawImage(0, 0, part); need_render = true; + need_restart = true; lock_drawing->unlock(); } @@ -173,6 +175,7 @@ void BasePreview::resizeEvent(QResizeEvent* event) this->pixbuf->fill(0x00000000); this->need_render = true; + this->need_restart = true; delete image; @@ -190,17 +193,17 @@ void BasePreview::renderPixbuf() QColor col; bool done; int x, y, w, h; - QImage* current_pixbuf; w = this->pixbuf->width(); h = this->pixbuf->height(); - current_pixbuf = this->pixbuf; + + this->need_restart = false; for (x = 0; x < w; x++) { this->lock_drawing->lock(); - if (!this->alive || this->pixbuf != current_pixbuf) + if (this->need_restart || !this->alive) { this->lock_drawing->unlock(); return; @@ -209,7 +212,7 @@ void BasePreview::renderPixbuf() done = false; for (y = 0; y < h; y++) { - if (!this->alive || this->pixbuf != current_pixbuf) + if (this->need_restart || !this->alive) { this->lock_drawing->unlock(); return; diff --git a/gui_qt/basepreview.h b/gui_qt/basepreview.h index 00c6c39..ca7ce06 100644 --- a/gui_qt/basepreview.h +++ b/gui_qt/basepreview.h @@ -48,6 +48,7 @@ private: int mousey; bool alive; + bool need_restart; bool need_render; double conf_scroll_xmin;