Removed old render area code in dialogrender
This commit is contained in:
parent
b86669c5a0
commit
fb3d32baf4
2 changed files with 0 additions and 65 deletions
|
@ -24,30 +24,6 @@
|
||||||
#include "SoftwareCanvasRenderer.h"
|
#include "SoftwareCanvasRenderer.h"
|
||||||
#include "WidgetPreviewCanvas.h"
|
#include "WidgetPreviewCanvas.h"
|
||||||
|
|
||||||
static DialogRender* _current_dialog;
|
|
||||||
|
|
||||||
static void _renderStart(int width, int height, const 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _renderDraw(int x, int y, const Color &col)
|
|
||||||
{
|
|
||||||
_current_dialog->pixbuf->setPixel(x, _current_dialog->pixbuf->height() - 1 - y, colorToQColor(col).rgb());
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _renderUpdate(double progress)
|
|
||||||
{
|
|
||||||
_current_dialog->area->update();
|
|
||||||
_current_dialog->tellProgressChange(progress);
|
|
||||||
}
|
|
||||||
|
|
||||||
class RenderThread:public QThread
|
class RenderThread:public QThread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -69,30 +45,11 @@ private:
|
||||||
RenderConfig _params;
|
RenderConfig _params;
|
||||||
};
|
};
|
||||||
|
|
||||||
class _RenderArea:public QWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
_RenderArea(QWidget* parent):
|
|
||||||
QWidget(parent)
|
|
||||||
{
|
|
||||||
setMinimumSize(800, 600);
|
|
||||||
}
|
|
||||||
|
|
||||||
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, SoftwareCanvasRenderer* renderer):
|
DialogRender::DialogRender(QWidget *parent, SoftwareCanvasRenderer* 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_lock = new QMutex();
|
||||||
pixbuf = new QImage(1, 1, QImage::Format_ARGB32);
|
pixbuf = new QImage(1, 1, QImage::Format_ARGB32);
|
||||||
_current_dialog = this;
|
|
||||||
_render_thread = NULL;
|
_render_thread = NULL;
|
||||||
canvas_renderer = renderer;
|
canvas_renderer = renderer;
|
||||||
|
|
||||||
|
@ -100,12 +57,6 @@ DialogRender::DialogRender(QWidget *parent, SoftwareCanvasRenderer* renderer):
|
||||||
setWindowTitle(tr("Paysages 3D - Render"));
|
setWindowTitle(tr("Paysages 3D - Render"));
|
||||||
setLayout(new QVBoxLayout());
|
setLayout(new QVBoxLayout());
|
||||||
|
|
||||||
_scroll = new QScrollArea(this);
|
|
||||||
_scroll->setAlignment(Qt::AlignCenter);
|
|
||||||
area = new _RenderArea(_scroll);
|
|
||||||
_scroll->setWidget(area);
|
|
||||||
layout()->addWidget(_scroll);
|
|
||||||
|
|
||||||
canvas_preview = new WidgetPreviewCanvas(this);
|
canvas_preview = new WidgetPreviewCanvas(this);
|
||||||
canvas_preview->setCanvas(canvas_renderer->getCanvas());
|
canvas_preview->setCanvas(canvas_renderer->getCanvas());
|
||||||
layout()->addWidget(canvas_preview);
|
layout()->addWidget(canvas_preview);
|
||||||
|
@ -189,8 +140,6 @@ void DialogRender::startRender(const RenderConfig ¶ms)
|
||||||
|
|
||||||
canvas_renderer->setSize(params.width, params.height, params.antialias);
|
canvas_renderer->setSize(params.width, params.height, params.antialias);
|
||||||
|
|
||||||
applyRenderSize(params.width, params.height);
|
|
||||||
|
|
||||||
_render_thread = new RenderThread(this, canvas_renderer, params);
|
_render_thread = new RenderThread(this, canvas_renderer, params);
|
||||||
_render_thread->start();
|
_render_thread->start();
|
||||||
|
|
||||||
|
@ -201,8 +150,6 @@ void DialogRender::applyRenderEnded()
|
||||||
{
|
{
|
||||||
_info->hide();
|
_info->hide();
|
||||||
_actions->show();
|
_actions->show();
|
||||||
|
|
||||||
area->update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogRender::saveRender()
|
void DialogRender::saveRender()
|
||||||
|
@ -236,21 +183,12 @@ void DialogRender::toneMappingChanged()
|
||||||
|
|
||||||
void DialogRender::loadLastRender()
|
void DialogRender::loadLastRender()
|
||||||
{
|
{
|
||||||
applyRenderSize(canvas_renderer->render_width, canvas_renderer->render_height);
|
|
||||||
renderEnded();
|
renderEnded();
|
||||||
toneMappingChanged();
|
toneMappingChanged();
|
||||||
|
|
||||||
exec();
|
exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogRender::applyRenderSize(int width, int height)
|
|
||||||
{
|
|
||||||
area->setMinimumSize(width, height);
|
|
||||||
area->setMaximumSize(width, height);
|
|
||||||
area->resize(width, height);
|
|
||||||
_scroll->setMinimumSize(width > 800 ? 820 : width + 20, height > 600 ? 620 : height + 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogRender::applyProgress(double value)
|
void DialogRender::applyProgress(double value)
|
||||||
{
|
{
|
||||||
double diff = difftime(time(NULL), _started);
|
double diff = difftime(time(NULL), _started);
|
||||||
|
|
|
@ -29,10 +29,8 @@ public:
|
||||||
|
|
||||||
QImage* pixbuf;
|
QImage* pixbuf;
|
||||||
QMutex* pixbuf_lock;
|
QMutex* pixbuf_lock;
|
||||||
QWidget* area;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void applyRenderSize(int width, int height);
|
|
||||||
void applyProgress(double value);
|
void applyProgress(double value);
|
||||||
void saveRender();
|
void saveRender();
|
||||||
void applyRenderEnded();
|
void applyRenderEnded();
|
||||||
|
@ -47,7 +45,6 @@ private:
|
||||||
SoftwareCanvasRenderer* canvas_renderer;
|
SoftwareCanvasRenderer* canvas_renderer;
|
||||||
WidgetPreviewCanvas* canvas_preview;
|
WidgetPreviewCanvas* canvas_preview;
|
||||||
|
|
||||||
QScrollArea* _scroll;
|
|
||||||
QWidget* _info;
|
QWidget* _info;
|
||||||
QWidget* _actions;
|
QWidget* _actions;
|
||||||
QComboBox* _tonemapping_control;
|
QComboBox* _tonemapping_control;
|
||||||
|
|
Loading…
Reference in a new issue