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:
Michaël Lemaire 2012-12-24 14:13:19 +00:00 committed by ThunderK
parent a50b0a25c2
commit 67eadf9048
5 changed files with 37 additions and 28 deletions

View file

@ -123,7 +123,7 @@ void BaseExplorerChunk::setMaxTextureSize(int size)
_texture_max_size = size;
}
void BaseExplorerChunk::onCameraEvent(CameraDefinition* camera)
void BaseExplorerChunk::onCameraEvent(CameraDefinition*)
{
}
@ -136,16 +136,16 @@ bool BaseExplorerChunk::onMaintainEvent()
return false;
}
void BaseExplorerChunk::onRenderEvent(QGLWidget* widget)
void BaseExplorerChunk::onRenderEvent(QGLWidget*)
{
}
double BaseExplorerChunk::getDisplayedSizeHint(CameraDefinition* camera)
double BaseExplorerChunk::getDisplayedSizeHint(CameraDefinition*)
{
return 0.0;
}
Color BaseExplorerChunk::getTextureColor(double x, double y)
Color BaseExplorerChunk::getTextureColor(double, double)
{
return COLOR_TRANSPARENT;
}

View file

@ -137,7 +137,7 @@ bool DialogColorGradation::getGradation(QWidget* parent, ColorGradation* gradati
return (result != 0) ? true : false;
}
void DialogColorGradation::closeEvent(QCloseEvent* e)
void DialogColorGradation::closeEvent(QCloseEvent*)
{
reject();
}

View file

@ -15,9 +15,12 @@ static DialogRender* _current_dialog;
static void _renderStart(int width, int height, Color background)
{
_current_dialog->pixbuf_lock->lock();
delete _current_dialog->pixbuf;
_current_dialog->pixbuf = new QImage(width, height, QImage::Format_ARGB32);
_current_dialog->pixbuf->fill(colorToQColor(background).rgb());
_current_dialog->pixbuf_lock->unlock();
_current_dialog->tellRenderSize(width, height);
}
@ -61,13 +64,16 @@ public:
void paintEvent(QPaintEvent*)
{
QPainter painter(this);
_current_dialog->pixbuf_lock->lock();
painter.drawImage(0, 0, *_current_dialog->pixbuf);
_current_dialog->pixbuf_lock->unlock();
}
};
DialogRender::DialogRender(QWidget *parent, Renderer* renderer):
QDialog(parent, Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint)
{
pixbuf_lock = new QMutex();
pixbuf = new QImage(1, 1, QImage::Format_ARGB32);
_current_dialog = this;
_render_thread = NULL;
@ -111,6 +117,7 @@ DialogRender::~DialogRender()
delete _render_thread;
}
delete pixbuf;
delete pixbuf_lock;
}
void DialogRender::tellRenderSize(int width, int height)

View file

@ -7,6 +7,7 @@
#include <QProgressBar>
#include <QScrollArea>
#include <QLabel>
#include <QMutex>
#include "../lib_paysages/renderer.h"
class DialogRender : public QDialog
@ -22,6 +23,7 @@ public:
void loadLastRender();
QImage* pixbuf;
QMutex* pixbuf_lock;
QWidget* area;
private slots:

View file

@ -91,7 +91,7 @@ private:
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;
}