paysages : Fixed some crash when starting renders.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@487 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
a50b0a25c2
commit
67eadf9048
5 changed files with 37 additions and 28 deletions
|
@ -123,7 +123,7 @@ void BaseExplorerChunk::setMaxTextureSize(int size)
|
||||||
_texture_max_size = size;
|
_texture_max_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseExplorerChunk::onCameraEvent(CameraDefinition* camera)
|
void BaseExplorerChunk::onCameraEvent(CameraDefinition*)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,16 +136,16 @@ bool BaseExplorerChunk::onMaintainEvent()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseExplorerChunk::onRenderEvent(QGLWidget* widget)
|
void BaseExplorerChunk::onRenderEvent(QGLWidget*)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
double BaseExplorerChunk::getDisplayedSizeHint(CameraDefinition* camera)
|
double BaseExplorerChunk::getDisplayedSizeHint(CameraDefinition*)
|
||||||
{
|
{
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color BaseExplorerChunk::getTextureColor(double x, double y)
|
Color BaseExplorerChunk::getTextureColor(double, double)
|
||||||
{
|
{
|
||||||
return COLOR_TRANSPARENT;
|
return COLOR_TRANSPARENT;
|
||||||
}
|
}
|
|
@ -137,7 +137,7 @@ bool DialogColorGradation::getGradation(QWidget* parent, ColorGradation* gradati
|
||||||
return (result != 0) ? true : false;
|
return (result != 0) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogColorGradation::closeEvent(QCloseEvent* e)
|
void DialogColorGradation::closeEvent(QCloseEvent*)
|
||||||
{
|
{
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,12 @@ static DialogRender* _current_dialog;
|
||||||
|
|
||||||
static void _renderStart(int width, int height, Color background)
|
static void _renderStart(int width, int height, Color background)
|
||||||
{
|
{
|
||||||
|
_current_dialog->pixbuf_lock->lock();
|
||||||
delete _current_dialog->pixbuf;
|
delete _current_dialog->pixbuf;
|
||||||
_current_dialog->pixbuf = new QImage(width, height, QImage::Format_ARGB32);
|
_current_dialog->pixbuf = new QImage(width, height, QImage::Format_ARGB32);
|
||||||
_current_dialog->pixbuf->fill(colorToQColor(background).rgb());
|
_current_dialog->pixbuf->fill(colorToQColor(background).rgb());
|
||||||
|
_current_dialog->pixbuf_lock->unlock();
|
||||||
|
|
||||||
_current_dialog->tellRenderSize(width, height);
|
_current_dialog->tellRenderSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,13 +64,16 @@ public:
|
||||||
void paintEvent(QPaintEvent*)
|
void paintEvent(QPaintEvent*)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
_current_dialog->pixbuf_lock->lock();
|
||||||
painter.drawImage(0, 0, *_current_dialog->pixbuf);
|
painter.drawImage(0, 0, *_current_dialog->pixbuf);
|
||||||
|
_current_dialog->pixbuf_lock->unlock();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
DialogRender::DialogRender(QWidget *parent, Renderer* renderer):
|
DialogRender::DialogRender(QWidget *parent, Renderer* renderer):
|
||||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint)
|
QDialog(parent, Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint)
|
||||||
{
|
{
|
||||||
|
pixbuf_lock = new QMutex();
|
||||||
pixbuf = new QImage(1, 1, QImage::Format_ARGB32);
|
pixbuf = new QImage(1, 1, QImage::Format_ARGB32);
|
||||||
_current_dialog = this;
|
_current_dialog = this;
|
||||||
_render_thread = NULL;
|
_render_thread = NULL;
|
||||||
|
@ -111,6 +117,7 @@ DialogRender::~DialogRender()
|
||||||
delete _render_thread;
|
delete _render_thread;
|
||||||
}
|
}
|
||||||
delete pixbuf;
|
delete pixbuf;
|
||||||
|
delete pixbuf_lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogRender::tellRenderSize(int width, int height)
|
void DialogRender::tellRenderSize(int width, int height)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QMutex>
|
||||||
#include "../lib_paysages/renderer.h"
|
#include "../lib_paysages/renderer.h"
|
||||||
|
|
||||||
class DialogRender : public QDialog
|
class DialogRender : public QDialog
|
||||||
|
@ -22,6 +23,7 @@ public:
|
||||||
void loadLastRender();
|
void loadLastRender();
|
||||||
|
|
||||||
QImage* pixbuf;
|
QImage* pixbuf;
|
||||||
|
QMutex* pixbuf_lock;
|
||||||
QWidget* area;
|
QWidget* area;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -91,7 +91,7 @@ private:
|
||||||
lightingGetStatus((LightingDefinition*)renderer->customData[2], renderer, location, status);
|
lightingGetStatus((LightingDefinition*)renderer->customData[2], renderer, location, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Color _applyAerialPerspective(Renderer* renderer, Vector3 location, Color base)
|
static Color _applyAerialPerspective(Renderer*, Vector3, Color base)
|
||||||
{
|
{
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue