tahoma2d/toonz/sources/common/tfx/trendererP.h

64 lines
1.8 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef TRENDERERP_INCLUDE
#define TRENDERERP_INCLUDE
#include <QObject>
#include <QMetaType>
#include "trenderer.h"
//=============================================================================================
//! This is a private class used to convey the TRenderer::startRendering
2016-06-15 18:43:10 +12:00
//! methods into Qt queued slots. This is necessary since these methods
//! implicitly
//! perform event processing, which could cause trouble in case they are invoked
//! from
2016-03-19 06:57:51 +13:00
//! events which must respect a strict ordering.
//! \n \n
//! For example, suppose that a render must be invoked upon a mousePressEvent,
2016-06-15 18:43:10 +12:00
//! and that such event must have been completely processed before the
//! corrispondant
//! mouseReleaseEvent is invoked - calling the startRendering method *directly*
//! by
//! the mousePressEvent may cause the mouseReleaseEvent to be processed before
//! the
2016-03-19 06:57:51 +13:00
//! former's end.
2016-06-15 18:43:10 +12:00
class TRendererStartInvoker : public QObject {
Q_OBJECT
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
struct StartInvokerRenderData {
unsigned long m_renderId;
const RenderDataVector *m_renderDataVector;
};
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TRendererStartInvoker() {
qRegisterMetaType<StartInvokerRenderData>("StartInvokerRenderData");
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
connect(this, SIGNAL(startRender(TRendererImp *, StartInvokerRenderData)),
this, SLOT(doStartRender(TRendererImp *, StartInvokerRenderData)),
Qt::QueuedConnection);
}
~TRendererStartInvoker() {}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
static TRendererStartInvoker *instance() {
static TRendererStartInvoker theInstance;
return &theInstance;
}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void emitStartRender(TRendererImp *renderer, StartInvokerRenderData rd);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
Q_SIGNALS:
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void startRender(TRendererImp *, StartInvokerRenderData);
2016-03-19 06:57:51 +13:00
public Q_SLOTS:
2016-06-15 18:43:10 +12:00
void doStartRender(TRendererImp *, StartInvokerRenderData rd);
2016-03-19 06:57:51 +13:00
};
2016-06-15 18:43:10 +12:00
#endif // TRENDERERP_INCLUDE