From 3c2137ded11e9014c983527cdde0e38f7c5d3452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Tue, 1 May 2012 11:39:04 +0000 Subject: [PATCH] paysages : Preview improvements. git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@315 b1fd45b6-86a6-48da-8261-f70d1f35bdcc --- TODO | 6 +++--- gui_qt/basepreview.cpp | 14 ++++++++++++-- gui_qt/basepreview.h | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 301ceb7..8c78db9 100644 --- a/TODO +++ b/TODO @@ -11,10 +11,10 @@ Technology Preview 2 : - Improve curve editor. - Water and terrain LOD moves with the camera, fix it like in the wanderer. - There should not have to be more preview threads than cpu cores. -- Add preview threads pausing (for rendering). -- Add preview chunks priority (for visible previews). -- Interrupt preview chunk renderings that will be discarded at commit. +- Pause previews drawing of main window when a dialog is opened. +- Interrupt preview chunk renderings that will be discarded at commit, or that are no more visible. - Can't overwrite picture files (ILError). +- Fix "RGB parameters out of range" on preview while moving render size fast in render tab. Technology Preview 3 : - Restore render progress. diff --git a/gui_qt/basepreview.cpp b/gui_qt/basepreview.cpp index 2e7f18d..e086923 100644 --- a/gui_qt/basepreview.cpp +++ b/gui_qt/basepreview.cpp @@ -47,6 +47,11 @@ public: { _need_render = false; + if (!_preview->isVisible()) + { + return false; + } + QImage pixbuf = _preview->startChunkTransaction(_xstart, _ystart, _xsize, _ysize, &revision); for (int x = 0; x < _xsize; x++) @@ -108,7 +113,7 @@ void PreviewDrawingThread::run() while (_running) { _drawing_manager->performOneThreadJob(); - QThread::usleep(50000); + QThread::usleep(5000); } } @@ -124,7 +129,7 @@ PreviewDrawingManager::PreviewDrawingManager() void PreviewDrawingManager::startThreads() { - for (int i = 0; i < _thread_count * 3; i++) + for (int i = 0; i < _thread_count; i++) { PreviewDrawingThread* thread = new PreviewDrawingThread(); _threads.append(thread); @@ -363,6 +368,11 @@ void BasePreview::handleRedraw() lock_drawing->unlock(); } +void BasePreview::showEvent(QShowEvent* event) +{ + updateChunks(); +} + void BasePreview::resizeEvent(QResizeEvent* event) { QImage* image; diff --git a/gui_qt/basepreview.h b/gui_qt/basepreview.h index bddcc16..30859c1 100644 --- a/gui_qt/basepreview.h +++ b/gui_qt/basepreview.h @@ -40,6 +40,7 @@ private: void updateScaling(); void updateChunks(); + void showEvent(QShowEvent* event); void resizeEvent(QResizeEvent* event); void paintEvent(QPaintEvent* event);