paysages: Fixed previews for win32.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@302 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-04-16 20:55:05 +00:00 committed by ThunderK
parent 69be8004a7
commit 3c7c682e07
2 changed files with 8 additions and 4 deletions

View file

@ -60,6 +60,7 @@ BasePreview::BasePreview(QWidget* parent) :
this->pixbuf->fill(0x00000000); this->pixbuf->fill(0x00000000);
this->alive = true; this->alive = true;
this->need_restart = false;
this->need_render = true; this->need_render = true;
QObject::connect(this, SIGNAL(contentChange()), this, SLOT(update())); QObject::connect(this, SIGNAL(contentChange()), this, SLOT(update()));
@ -157,6 +158,7 @@ void BasePreview::handleRedraw()
painter.drawImage(0, 0, part); painter.drawImage(0, 0, part);
need_render = true; need_render = true;
need_restart = true;
lock_drawing->unlock(); lock_drawing->unlock();
} }
@ -173,6 +175,7 @@ void BasePreview::resizeEvent(QResizeEvent* event)
this->pixbuf->fill(0x00000000); this->pixbuf->fill(0x00000000);
this->need_render = true; this->need_render = true;
this->need_restart = true;
delete image; delete image;
@ -190,17 +193,17 @@ void BasePreview::renderPixbuf()
QColor col; QColor col;
bool done; bool done;
int x, y, w, h; int x, y, w, h;
QImage* current_pixbuf;
w = this->pixbuf->width(); w = this->pixbuf->width();
h = this->pixbuf->height(); h = this->pixbuf->height();
current_pixbuf = this->pixbuf;
this->need_restart = false;
for (x = 0; x < w; x++) for (x = 0; x < w; x++)
{ {
this->lock_drawing->lock(); this->lock_drawing->lock();
if (!this->alive || this->pixbuf != current_pixbuf) if (this->need_restart || !this->alive)
{ {
this->lock_drawing->unlock(); this->lock_drawing->unlock();
return; return;
@ -209,7 +212,7 @@ void BasePreview::renderPixbuf()
done = false; done = false;
for (y = 0; y < h; y++) for (y = 0; y < h; y++)
{ {
if (!this->alive || this->pixbuf != current_pixbuf) if (this->need_restart || !this->alive)
{ {
this->lock_drawing->unlock(); this->lock_drawing->unlock();
return; return;

View file

@ -48,6 +48,7 @@ private:
int mousey; int mousey;
bool alive; bool alive;
bool need_restart;
bool need_render; bool need_render;
double conf_scroll_xmin; double conf_scroll_xmin;