diff options
Diffstat (limited to 'src/opengl/qpixmapdata_gl_p.h')
-rw-r--r-- | src/opengl/qpixmapdata_gl_p.h | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h index 8212df2..ab1ff47 100644 --- a/src/opengl/qpixmapdata_gl_p.h +++ b/src/opengl/qpixmapdata_gl_p.h @@ -53,6 +53,7 @@ // We mean it. // +#include "qgl_p.h" #include "qgl.h" #include "private/qpixmapdata_p.h" @@ -60,6 +61,20 @@ QT_BEGIN_NAMESPACE class QPaintEngine; +class QGLFramebufferObject; +class QGLFramebufferObjectFormat; + +class QGLFramebufferObjectPool +{ +public: + QGLFramebufferObject *acquire(const QSize &size, const QGLFramebufferObjectFormat &format); + void release(QGLFramebufferObject *fbo); + +private: + QList<QGLFramebufferObject *> m_fbos; +}; + +QGLFramebufferObjectPool* qgl_fbo_pool(); class QGLPixmapData : public QPixmapData { @@ -72,19 +87,36 @@ public: void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); + void copy(const QPixmapData *data, const QRect &rect); + + bool scroll(int dx, int dy, const QRect &rect); void fill(const QColor &color); bool hasAlphaChannel() const; QImage toImage() const; - QPaintEngine* paintEngine() const; + QPaintEngine *paintEngine() const; - GLuint bind() const; + GLuint bind(bool copyBack = true) const; GLuint textureId() const; + QGLTexture *texture() const; bool isValidContext(const QGLContext *ctx) const; void ensureCreated() const; + bool isUninitialized() const { return m_dirty && m_source.isNull(); } + + bool needsFill() const { return m_hasFillColor; } + QColor fillColor() const { return m_fillColor; } + + QSize size() const { return QSize(w, h); } + + QGLFramebufferObject *fbo() const; + + void makeCurrent(); + void doneCurrent(); + void swapBuffers(); + protected: int metric(QPaintDevice::PaintDeviceMetric metric) const; @@ -92,12 +124,27 @@ private: QGLPixmapData(const QGLPixmapData &other); QGLPixmapData &operator=(const QGLPixmapData &other); - int m_width; - int m_height; + void copyBackFromRenderFbo(bool keepCurrentFboBound) const; - mutable GLuint m_texture; - mutable bool m_dirty; + static bool useFramebufferObjects(); + + QImage fillImage(const QColor &color) const; + + mutable QGLFramebufferObject *m_renderFbo; + mutable QPaintEngine *m_engine; + mutable QGLContext *m_ctx; mutable QImage m_source; + mutable QGLTexture m_texture; + + // the texture is not in sync with the source image + mutable bool m_dirty; + + // fill has been called and no painting has been done, so the pixmap is + // represented by a single fill color + mutable QColor m_fillColor; + mutable bool m_hasFillColor; + + mutable bool m_hasAlpha; }; QT_END_NAMESPACE |