diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-05-26 08:58:30 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-05-27 10:43:18 (GMT) |
commit | 855022d6108f6b3c90832e742217c50550af717d (patch) | |
tree | 8cf799d7c939ee7cb9434cf1d3a100e898af6ce6 /src/opengl/qpixmapdata_gl_p.h | |
parent | 15c8f565973592c9929cdd6fc83d61641aa63afa (diff) | |
download | Qt-855022d6108f6b3c90832e742217c50550af717d.zip Qt-855022d6108f6b3c90832e742217c50550af717d.tar.gz Qt-855022d6108f6b3c90832e742217c50550af717d.tar.bz2 |
Avoided expensive image upload for GL pixmap backend for QPixmap::fill.
In the fill case we can simply set a flag saying the pixmap needs to be
filled, and then when painting on the pixmap we start by filling the
background using glClear via the existing
QGLDrawable::autoFillBackground interface.
Diffstat (limited to 'src/opengl/qpixmapdata_gl_p.h')
-rw-r--r-- | src/opengl/qpixmapdata_gl_p.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h index 7e06db9..1b6b7ae 100644 --- a/src/opengl/qpixmapdata_gl_p.h +++ b/src/opengl/qpixmapdata_gl_p.h @@ -91,6 +91,9 @@ public: 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(m_width, m_height); } int width() const { return m_width; } int height() const { return m_height; } @@ -119,8 +122,15 @@ private: mutable GLuint m_textureId; mutable QPaintEngine *m_engine; mutable QGLContext *m_ctx; - mutable bool m_dirty; mutable QImage m_source; + + // 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; }; QT_END_NAMESPACE |