2012-02-21 13:41:02 +00:00
|
|
|
#include "basepreview.h"
|
2012-02-06 20:54:23 +00:00
|
|
|
|
2011-12-26 21:53:29 +00:00
|
|
|
#include <QVector>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QTimer>
|
2012-02-06 20:54:23 +00:00
|
|
|
#include <QWheelEvent>
|
2011-12-26 21:53:29 +00:00
|
|
|
|
|
|
|
class PreviewDrawer:public QThread
|
|
|
|
{
|
|
|
|
public:
|
2012-02-21 13:41:02 +00:00
|
|
|
PreviewDrawer(BasePreview* preview):
|
2012-01-18 16:20:14 +00:00
|
|
|
QThread(),
|
|
|
|
_preview(preview)
|
2011-12-26 21:53:29 +00:00
|
|
|
{
|
2012-01-18 16:20:14 +00:00
|
|
|
_running = false;
|
|
|
|
}
|
|
|
|
void askStop()
|
|
|
|
{
|
|
|
|
_running = false;
|
2011-12-26 21:53:29 +00:00
|
|
|
}
|
|
|
|
protected:
|
|
|
|
void run()
|
|
|
|
{
|
2012-01-18 16:20:14 +00:00
|
|
|
_running = true;
|
|
|
|
while (_running)
|
2011-12-26 21:53:29 +00:00
|
|
|
{
|
2012-01-18 16:20:14 +00:00
|
|
|
_preview->doRender();
|
2011-12-26 21:53:29 +00:00
|
|
|
QThread::usleep(50000);
|
|
|
|
}
|
|
|
|
}
|
2012-01-18 16:20:14 +00:00
|
|
|
private:
|
2012-02-21 13:41:02 +00:00
|
|
|
BasePreview* _preview;
|
2012-01-18 16:20:14 +00:00
|
|
|
bool _running;
|
2011-12-26 21:53:29 +00:00
|
|
|
};
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
BasePreview::BasePreview(QWidget* parent) :
|
2011-12-26 21:53:29 +00:00
|
|
|
QWidget(parent)
|
|
|
|
{
|
2012-01-25 22:32:06 +00:00
|
|
|
this->lock_drawing = new QMutex();
|
|
|
|
|
2011-12-26 21:53:29 +00:00
|
|
|
this->conf_scroll_xmin = 0.0;
|
|
|
|
this->conf_scroll_xmax = 0.0;
|
|
|
|
this->conf_scroll_ymin = 0.0;
|
|
|
|
this->conf_scroll_ymax = 0.0;
|
|
|
|
this->conf_scale_min = 1.0;
|
|
|
|
this->conf_scale_max = 1.0;
|
2012-04-12 20:02:31 +00:00
|
|
|
this->conf_scale_init = 1.0;
|
2011-12-26 21:53:29 +00:00
|
|
|
this->conf_scale_step = 0.0;
|
|
|
|
this->scaling = 1.0;
|
|
|
|
this->xoffset = 0.0;
|
|
|
|
this->yoffset = 0.0;
|
|
|
|
this->pixbuf = new QImage(this->size(), QImage::Format_ARGB32);
|
2012-01-22 18:39:42 +00:00
|
|
|
this->pixbuf->fill(0x00000000);
|
2012-01-16 21:29:21 +00:00
|
|
|
|
|
|
|
this->alive = true;
|
|
|
|
this->need_rerender = false;
|
2012-01-22 18:39:42 +00:00
|
|
|
this->need_render = true;
|
2011-12-26 21:53:29 +00:00
|
|
|
|
2012-01-05 16:32:41 +00:00
|
|
|
this->setMinimumSize(256, 256);
|
|
|
|
this->setMaximumSize(256, 256);
|
|
|
|
this->resize(256, 256);
|
2012-01-16 21:29:21 +00:00
|
|
|
|
2012-01-22 18:39:42 +00:00
|
|
|
QObject::connect(this, SIGNAL(contentChange()), this, SLOT(update()));
|
2012-01-25 22:32:06 +00:00
|
|
|
QObject::connect(this, SIGNAL(redrawRequested()), this, SLOT(handleRedraw()));
|
2012-01-22 18:39:42 +00:00
|
|
|
|
2012-01-18 16:20:14 +00:00
|
|
|
this->updater = new PreviewDrawer(this);
|
2012-01-16 21:29:21 +00:00
|
|
|
}
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
BasePreview::~BasePreview()
|
2012-01-16 21:29:21 +00:00
|
|
|
{
|
2012-01-18 16:20:14 +00:00
|
|
|
alive = false;
|
2012-01-25 22:32:06 +00:00
|
|
|
|
2012-01-18 16:20:14 +00:00
|
|
|
((PreviewDrawer*)updater)->askStop();
|
|
|
|
updater->wait();
|
2012-01-25 22:32:06 +00:00
|
|
|
|
2012-01-18 16:20:14 +00:00
|
|
|
delete updater;
|
2012-01-16 21:29:21 +00:00
|
|
|
delete pixbuf;
|
2012-02-05 12:17:51 +00:00
|
|
|
delete lock_drawing;
|
|
|
|
}
|
2012-01-25 22:32:06 +00:00
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
void BasePreview::updateData()
|
2012-01-25 22:32:06 +00:00
|
|
|
{
|
2011-12-26 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
QColor BasePreview::getColor(double x, double y)
|
2012-01-18 19:49:03 +00:00
|
|
|
{
|
|
|
|
return QColor(0, 0, 0);
|
|
|
|
}
|
|
|
|
|
2012-04-12 20:02:31 +00:00
|
|
|
void BasePreview::configScaling(double min, double max, double step, double init)
|
|
|
|
{
|
|
|
|
double size = (double)width();
|
|
|
|
|
|
|
|
if (size >= 1.0)
|
|
|
|
{
|
|
|
|
conf_scale_min = min / size;
|
|
|
|
conf_scale_max = max / size;
|
|
|
|
conf_scale_step = step / size;
|
|
|
|
conf_scale_init = init / size;
|
|
|
|
scaling = init / size;
|
|
|
|
redraw();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
void BasePreview::start()
|
2012-02-05 12:17:51 +00:00
|
|
|
{
|
|
|
|
this->updater->start();
|
|
|
|
}
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
void BasePreview::doRender()
|
2011-12-26 21:53:29 +00:00
|
|
|
{
|
2012-01-16 21:29:21 +00:00
|
|
|
if (this->alive)
|
2011-12-26 21:53:29 +00:00
|
|
|
{
|
2012-01-16 21:29:21 +00:00
|
|
|
if (this->need_rerender)
|
|
|
|
{
|
|
|
|
this->forceRender();
|
|
|
|
}
|
|
|
|
if (this->need_render)
|
|
|
|
{
|
2012-01-22 18:39:42 +00:00
|
|
|
this->need_render = false;
|
2012-01-16 21:29:21 +00:00
|
|
|
this->renderPixbuf();
|
|
|
|
}
|
2011-12-26 21:53:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
void BasePreview::redraw()
|
2011-12-27 19:03:46 +00:00
|
|
|
{
|
2012-01-25 22:32:06 +00:00
|
|
|
emit(redrawRequested());
|
|
|
|
}
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
void BasePreview::handleRedraw()
|
2012-01-25 22:32:06 +00:00
|
|
|
{
|
|
|
|
need_rerender = true;
|
|
|
|
lock_drawing->lock();
|
|
|
|
updateData();
|
2012-01-22 18:39:42 +00:00
|
|
|
need_rerender = true;
|
2012-01-25 22:32:06 +00:00
|
|
|
lock_drawing->unlock();
|
2011-12-27 19:03:46 +00:00
|
|
|
}
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
void BasePreview::resizeEvent(QResizeEvent* event)
|
2011-12-26 21:53:29 +00:00
|
|
|
{
|
|
|
|
QImage* image;
|
|
|
|
|
2012-01-25 22:32:06 +00:00
|
|
|
this->lock_drawing->lock();
|
2012-01-22 18:39:42 +00:00
|
|
|
|
2011-12-26 21:53:29 +00:00
|
|
|
image = this->pixbuf;
|
2012-01-22 18:39:42 +00:00
|
|
|
|
2011-12-26 21:53:29 +00:00
|
|
|
this->pixbuf = new QImage(this->size(), QImage::Format_ARGB32);
|
2012-01-22 18:39:42 +00:00
|
|
|
|
|
|
|
this->pixbuf->fill(0x00000000);
|
2012-01-25 17:31:36 +00:00
|
|
|
this->need_rerender = true;
|
2012-01-22 18:39:42 +00:00
|
|
|
this->need_render = true;
|
|
|
|
|
2011-12-26 21:53:29 +00:00
|
|
|
delete image;
|
|
|
|
|
2012-01-25 22:32:06 +00:00
|
|
|
this->lock_drawing->unlock();
|
2011-12-26 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
void BasePreview::paintEvent(QPaintEvent* event)
|
2011-12-26 21:53:29 +00:00
|
|
|
{
|
|
|
|
QPainter painter(this);
|
|
|
|
painter.drawImage(0, 0, *this->pixbuf);
|
|
|
|
}
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
void BasePreview::forceRender()
|
2011-12-26 21:53:29 +00:00
|
|
|
{
|
2012-01-25 22:32:06 +00:00
|
|
|
this->lock_drawing->lock();
|
2011-12-26 21:53:29 +00:00
|
|
|
this->pixbuf->fill(0x00000000);
|
2012-01-22 18:39:42 +00:00
|
|
|
this->need_rerender = false;
|
|
|
|
this->need_render = true;
|
2012-01-25 22:32:06 +00:00
|
|
|
this->lock_drawing->unlock();
|
2011-12-26 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
void BasePreview::renderPixbuf()
|
2011-12-26 21:53:29 +00:00
|
|
|
{
|
|
|
|
QColor col;
|
|
|
|
bool done;
|
|
|
|
int x, y, w, h;
|
|
|
|
|
|
|
|
w = this->pixbuf->width();
|
|
|
|
h = this->pixbuf->height();
|
|
|
|
|
|
|
|
for (x = 0; x < w; x++)
|
|
|
|
{
|
2012-01-25 22:32:06 +00:00
|
|
|
this->lock_drawing->lock();
|
2011-12-26 21:53:29 +00:00
|
|
|
|
2012-01-16 21:29:21 +00:00
|
|
|
if (this->need_rerender || !this->alive)
|
2011-12-26 21:53:29 +00:00
|
|
|
{
|
2012-01-25 22:32:06 +00:00
|
|
|
this->lock_drawing->unlock();
|
|
|
|
return;
|
2011-12-26 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
done = false;
|
|
|
|
for (y = 0; y < h; y++)
|
|
|
|
{
|
2012-01-25 22:32:06 +00:00
|
|
|
if (this->need_rerender || !this->alive)
|
|
|
|
{
|
|
|
|
this->lock_drawing->unlock();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-12-26 21:53:29 +00:00
|
|
|
if (qAlpha(this->pixbuf->pixel(x, y)) == 0)
|
|
|
|
{
|
|
|
|
col = this->getColor((double)(x - w / 2) * this->scaling + this->xoffset, (double)(y - h / 2) * this->scaling + this->yoffset);
|
|
|
|
this->pixbuf->setPixel(x, y, col.rgb());
|
|
|
|
done = true;
|
|
|
|
}
|
|
|
|
}
|
2012-01-07 16:53:23 +00:00
|
|
|
if (done && (x == w - 1 || x % 10 == 0))
|
2011-12-26 21:53:29 +00:00
|
|
|
{
|
2012-01-22 18:39:42 +00:00
|
|
|
emit contentChange();
|
2011-12-26 21:53:29 +00:00
|
|
|
}
|
2012-01-25 22:32:06 +00:00
|
|
|
this->lock_drawing->unlock();
|
2011-12-26 21:53:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
void BasePreview::wheelEvent(QWheelEvent* event)
|
2012-02-06 20:54:23 +00:00
|
|
|
{
|
2012-04-12 20:02:31 +00:00
|
|
|
double factor;
|
|
|
|
|
|
|
|
if (event->modifiers() & Qt::ShiftModifier)
|
|
|
|
{
|
|
|
|
factor = 5.0;
|
|
|
|
}
|
|
|
|
else if (event->modifiers() & Qt::ControlModifier)
|
|
|
|
{
|
|
|
|
factor = 0.2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
factor = 1.0;
|
|
|
|
}
|
|
|
|
|
2012-02-06 20:54:23 +00:00
|
|
|
if (event->orientation() == Qt::Vertical)
|
|
|
|
{
|
2012-04-12 20:02:31 +00:00
|
|
|
if (event->delta() > 0 && scaling > conf_scale_min)
|
2012-02-06 20:54:23 +00:00
|
|
|
{
|
2012-04-12 20:02:31 +00:00
|
|
|
scaling -= conf_scale_step * factor;
|
|
|
|
if (scaling < conf_scale_min)
|
|
|
|
{
|
|
|
|
scaling = conf_scale_min;
|
|
|
|
}
|
2012-02-06 20:54:23 +00:00
|
|
|
redraw();
|
|
|
|
}
|
2012-04-12 20:02:31 +00:00
|
|
|
else if (event->delta() < 0 && scaling < conf_scale_max)
|
2012-02-06 20:54:23 +00:00
|
|
|
{
|
2012-04-12 20:02:31 +00:00
|
|
|
scaling += conf_scale_step * factor;
|
|
|
|
if (scaling > conf_scale_max)
|
|
|
|
{
|
|
|
|
scaling = conf_scale_max;
|
|
|
|
}
|
2012-02-06 20:54:23 +00:00
|
|
|
redraw();
|
|
|
|
}
|
|
|
|
event->accept();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
event->ignore();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-26 21:53:29 +00:00
|
|
|
//static void _scrollPixbuf(SmallPreview* preview, int dx, int dy)
|
|
|
|
//{
|
|
|
|
// int xstart, ystart, xsize, ysize, y;
|
|
|
|
// void* pixels = gdk_pixbuf_get_pixels(preview->pixbuf);
|
|
|
|
// int rowstride = gdk_pixbuf_get_rowstride(preview->pixbuf);
|
|
|
|
|
|
|
|
// preview->xoffset -= (double)dx * preview->scaling;
|
|
|
|
// preview->yoffset -= (double)dy * preview->scaling;
|
|
|
|
|
|
|
|
// /* TODO Use pixbuf size */
|
|
|
|
// if (dx == 0 && dy == 0)
|
|
|
|
// {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// else if (dx <= -256 || dx >= 256 || dy <= -256 || dy >= 256)
|
|
|
|
// {
|
|
|
|
// _forceRender(preview);
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// if (dx < 0)
|
|
|
|
// {
|
|
|
|
// xstart = -dx;
|
|
|
|
// xsize = 256 + dx;
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// xstart = 0;
|
|
|
|
// xsize = 256 - dx;
|
|
|
|
// }
|
|
|
|
// if (dy < 0)
|
|
|
|
// {
|
|
|
|
// ystart = -dy;
|
|
|
|
// ysize = 256 + dy;
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// ystart = 0;
|
|
|
|
// ysize = 256 - dy;
|
|
|
|
// }
|
|
|
|
// memmove(pixels + (ystart + dy) * rowstride + (xstart + dx) * 4, pixels + ystart * rowstride + xstart * 4, (ysize - 1) * rowstride + xsize * 4);
|
|
|
|
// if (dy < 0)
|
|
|
|
// {
|
|
|
|
// memset(pixels + (256 + dy) * rowstride, 0, (-dy - 1) * rowstride + 256 * 4);
|
|
|
|
// }
|
|
|
|
// else if (dy > 0)
|
|
|
|
// {
|
|
|
|
// memset(pixels, 0, (dy - 1) * rowstride + 256 * 4);
|
|
|
|
// }
|
|
|
|
// if (dx < 0)
|
|
|
|
// {
|
|
|
|
// for (y = ystart + dy; y < ystart + dy + ysize; y++)
|
|
|
|
// {
|
|
|
|
// memset(pixels + y * rowstride + xsize * 4, 0, -dx * 4);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// else if (dx > 0)
|
|
|
|
// {
|
|
|
|
// for (y = ystart + dy; y < ystart + dy + ysize; y++)
|
|
|
|
// {
|
|
|
|
// memset(pixels + y * rowstride, 0, dx * 4);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// preview->need_render = 1;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
//static inline int _fixScroll(SmallPreview* preview, int dx, int dy, int* new_dx, int* new_dy)
|
|
|
|
//{
|
|
|
|
// *new_dx = dx;
|
|
|
|
// *new_dy = dy;
|
|
|
|
// if (preview->xoffset - dx * preview->scaling > preview->conf_scroll_xmax)
|
|
|
|
// {
|
|
|
|
// *new_dx = (int)floor((preview->conf_scroll_xmax - preview->xoffset) / preview->scaling);
|
|
|
|
// }
|
|
|
|
// if (preview->xoffset - dx * preview->scaling < preview->conf_scroll_xmin)
|
|
|
|
// {
|
|
|
|
// *new_dx = (int)floor((preview->conf_scroll_xmin - preview->xoffset) / preview->scaling);
|
|
|
|
// }
|
|
|
|
// if (preview->yoffset - dy * preview->scaling > preview->conf_scroll_ymax)
|
|
|
|
// {
|
|
|
|
// *new_dy = (int)floor((preview->conf_scroll_ymax - preview->yoffset) / preview->scaling);
|
|
|
|
// }
|
|
|
|
// if (preview->yoffset - dy * preview->scaling < preview->conf_scroll_ymin)
|
|
|
|
// {
|
|
|
|
// *new_dy = (int)floor((preview->conf_scroll_ymin - preview->yoffset) / preview->scaling);
|
|
|
|
// }
|
|
|
|
// return (*new_dx == 0 && *new_dy == 0) ? 0 : 1;
|
|
|
|
//}
|
|
|
|
|
|
|
|
//static inline int _fixScaling(SmallPreview* preview, double scaling, double* new_scaling)
|
|
|
|
//{
|
|
|
|
// double old_scaling = preview->scaling;
|
|
|
|
// *new_scaling = scaling;
|
|
|
|
// if (scaling < preview->conf_scale_min)
|
|
|
|
// {
|
|
|
|
// *new_scaling = preview->conf_scale_min;
|
|
|
|
// }
|
|
|
|
// if (scaling > preview->conf_scale_max)
|
|
|
|
// {
|
|
|
|
// *new_scaling = preview->conf_scale_max;
|
|
|
|
// }
|
|
|
|
// return (old_scaling == *new_scaling) ? 0 : 1;
|
|
|
|
//}
|
|
|
|
|
|
|
|
//static int _cbMouseScroll(GtkEventBox* image, GdkEventScroll* event, gpointer data)
|
|
|
|
//{
|
|
|
|
// SmallPreview* preview = (SmallPreview*)data;
|
|
|
|
|
|
|
|
// /* TODO Center the zoom on the cursor */
|
|
|
|
|
|
|
|
// if (event->direction == GDK_SCROLL_UP)
|
|
|
|
// {
|
|
|
|
// mutexAcquire(preview->lock);
|
|
|
|
// if (_fixScaling(preview, preview->scaling - preview->conf_scale_step, &preview->scaling))
|
|
|
|
// {
|
|
|
|
// preview->need_rerender = 1;
|
|
|
|
// }
|
|
|
|
// mutexRelease(preview->lock);
|
|
|
|
// }
|
|
|
|
// else if (event->direction == GDK_SCROLL_DOWN)
|
|
|
|
// {
|
|
|
|
// mutexAcquire(preview->lock);
|
|
|
|
// if (_fixScaling(preview, preview->scaling + preview->conf_scale_step, &preview->scaling))
|
|
|
|
// {
|
|
|
|
// preview->need_rerender = 1;
|
|
|
|
// }
|
|
|
|
// mutexRelease(preview->lock);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// return 1;
|
|
|
|
//}
|
|
|
|
|
|
|
|
//static int _cbMouseButtonPressed(GtkEventBox* image, GdkEventButton* event, gpointer data)
|
|
|
|
//{
|
|
|
|
// SmallPreview* preview = (SmallPreview*)data;
|
|
|
|
|
|
|
|
// if (event->button == 1)
|
|
|
|
// {
|
|
|
|
// preview->mousex = (int)event->x;
|
|
|
|
// preview->mousey = (int)event->y;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// return 1;
|
|
|
|
//}
|
|
|
|
|
|
|
|
//static int _cbMouseMove(GtkEventBox* image, GdkEventMotion* event, gpointer data)
|
|
|
|
//{
|
|
|
|
// SmallPreview* preview = (SmallPreview*)data;
|
|
|
|
// int dx, dy;
|
|
|
|
|
|
|
|
// if (event->state & GDK_BUTTON1_MASK)
|
|
|
|
// {
|
|
|
|
// mutexAcquire(preview->lock);
|
|
|
|
|
|
|
|
// dx = (int)event->x - preview->mousex;
|
|
|
|
// dy = (int)event->y - preview->mousey;
|
|
|
|
|
|
|
|
// if (_fixScroll(preview, dx, dy, &dx, &dy))
|
|
|
|
// {
|
|
|
|
// _scrollPixbuf(preview, dx, dy);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// preview->mousex = (int)event->x;
|
|
|
|
// preview->mousey = (int)event->y;
|
|
|
|
|
|
|
|
// mutexRelease(preview->lock);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// return 1;
|
|
|
|
//}
|
|
|
|
|
|
|
|
//void guiPreviewRedrawAll()
|
|
|
|
//{
|
|
|
|
// int i;
|
|
|
|
|
|
|
|
// for (i = 0; i < _previews_count; i++)
|
|
|
|
// {
|
|
|
|
// guiPreviewRedraw(_preview + i);
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
//void guiPreviewConfigScrolling(SmallPreview* preview, double xmin, double xmax, double ymin, double ymax)
|
|
|
|
//{
|
|
|
|
// mutexAcquire(preview->lock);
|
|
|
|
// preview->conf_scroll_xmin = xmin;
|
|
|
|
// preview->conf_scroll_xmax = xmax;
|
|
|
|
// preview->conf_scroll_ymin = ymin;
|
|
|
|
// preview->conf_scroll_ymax = ymax;
|
|
|
|
// preview->need_rerender = 1;
|
|
|
|
// mutexRelease(preview->lock);
|
|
|
|
//}
|
|
|
|
|
|
|
|
//void guiPreviewConfigScaling(SmallPreview* preview, double min, double max, double step)
|
|
|
|
//{
|
|
|
|
// mutexAcquire(preview->lock);
|
|
|
|
// preview->conf_scale_min = min;
|
|
|
|
// preview->conf_scale_max = max;
|
|
|
|
// preview->conf_scale_step = step;
|
|
|
|
// preview->need_rerender = 1;
|
|
|
|
// mutexRelease(preview->lock);
|
|
|
|
//}
|
|
|
|
|
|
|
|
//void guiPreviewSetRenderer(SmallPreview* preview, SmallPreviewCallback renderer)
|
|
|
|
//{
|
|
|
|
// mutexAcquire(preview->lock);
|
|
|
|
// preview->renderer = renderer;
|
|
|
|
// preview->need_rerender = 1;
|
|
|
|
// mutexRelease(preview->lock);
|
|
|
|
//}
|
|
|
|
|
|
|
|
//void guiPreviewSetViewport(SmallPreview* preview, double xoffset, double yoffset, double scaling)
|
|
|
|
//{
|
|
|
|
// mutexAcquire(preview->lock);
|
|
|
|
// preview->xoffset = xoffset;
|
|
|
|
// preview->yoffset = yoffset;
|
|
|
|
// preview->scaling = scaling;
|
|
|
|
// preview->need_rerender = 1;
|
|
|
|
// mutexRelease(preview->lock);
|
|
|
|
//}
|
|
|
|
|
|
|
|
//void guiPreviewSetTerrainHeight(SmallPreview* preview)
|
|
|
|
//{
|
|
|
|
// /*preview->conf_scroll_x = 1;
|
|
|
|
// preview->conf_scroll_y = 1;
|
|
|
|
// preview->conf_zoom = 1;
|
|
|
|
// preview->init_scaling = preview->scaling = 0.1;
|
|
|
|
// preview->init_xoffset = preview->xoffset = 0.0;
|
|
|
|
// preview->init_yoffset = preview->yoffset = 0.0;
|
|
|
|
|
|
|
|
// preview->renderer = _renderTopDownHeight;*/
|
|
|
|
|
|
|
|
// guiPreviewRedraw(preview);
|
|
|
|
//}
|