#include <QtCore/qstack.h>
#include <QtCore/qqueue.h>
#include <private/qv8engine_p.h>
-
+#include <QtCore/QWaitCondition>
//#define QQUICKCONTEXT2D_DEBUG //enable this for just DEBUG purpose!
class QQuickContext2DTexture;
class QQuickPixmap;
class QSGTexture;
+class QQuickWindowManager;
+class QSurface;
+class QOpenGLContext;
-
-class Q_QUICK_EXPORT QQuickContext2D : public QQuickCanvasContext
+class QQuickContext2D : public QQuickCanvasContext
{
public:
+ Q_DISABLE_COPY(QQuickContext2D)
+
enum TextBaseLineType { Alphabetic=0, Top, Middle, Bottom, Hanging};
enum TextAlignType { Start=0, End, Left, Right, Center};
enum PaintCommand {
FillText,
StrokeText,
DrawImage,
+ DrawPixmap,
GetImageData
};
void prepare(const QSize& canvasSize, const QSize& tileSize, const QRect& canvasWindow, const QRect& dirtyRect, bool smooth);
void flush();
void sync();
+ QThread *thread() const {return m_thread;}
QSGDynamicTexture *texture() const;
QImage toImage(const QRectF& bounds);
bool isPointInPath(qreal x, qreal y) const;
QPainterPath createTextGlyphs(qreal x, qreal y, const QString& text);
- QImage createImage(const QUrl& url);
+ QQmlRefPointer<QQuickCanvasPixmap> createPixmap(const QUrl& url);
+
+ QOpenGLContext *glContext() { return m_glContext; }
+ QSurface *surface() { return m_surface; }
+ void setGrabbedImage(const QImage& grab);
State state;
QStack<QQuickContext2D::State> m_stateStack;
v8::Local<v8::Value> m_strokeStyle;
v8::Handle<v8::Value> m_v8path;
QV8Engine *m_v8engine;
+ QQuickWindowManager *m_windowManager;
+ QSurface *m_surface;
+ QOpenGLContext *m_glContext;
v8::Persistent<v8::Object> m_v8value;
QQuickContext2DTexture *m_texture;
QQuickCanvasItem::RenderTarget m_renderTarget;
QQuickCanvasItem::RenderStrategy m_renderStrategy;
QQueue<QQuickContext2DCommandBuffer*> m_bufferQueue;
- QMutex m_bufferMutex;
+ QThread *m_thread;
+ QImage m_grabbedImage;
+ bool m_grabbed:1;
+
+ QMutex m_mutex;
};