diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-09-07 08:58:31 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-09-08 16:36:15 (GMT) |
commit | 4feed48fdd738ed99cba86a4214e238a3e7275ed (patch) | |
tree | a9b3b41bc838275d56914b7f0d22e739794ae3c4 /src/opengl/qgl.cpp | |
parent | e8b5bfa8a86b2d7c79aabcc4566f740f0a9afe7c (diff) | |
download | Qt-4feed48fdd738ed99cba86a4214e238a3e7275ed.zip Qt-4feed48fdd738ed99cba86a4214e238a3e7275ed.tar.gz Qt-4feed48fdd738ed99cba86a4214e238a3e7275ed.tar.bz2 |
Move buffer clear out of the paint engine and into the QGLPaintDevices
Previously, the paint engine cleared the surface's buffers in begin.
This logic really belongs in QGLPaintDevice::beginPaint as not all paint
devices will want this behaviour (in fact most don't). This also makes
QGLPaintDevice API much simpler as the virtual getters for the clear
color, etc. can be removed. It's much cleaner this way. The only
possible problem is with the GL1 engine, which also cleared the
accumulation & depth buffers in begin. However, the engine will also
clear the depth buffer later as part of it's clipping logic. It also
doesn't use the accumulation buffer, so clearing it seems unnessisary.
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r-- | src/opengl/qgl.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index ad54298..8ad9860 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1399,7 +1399,6 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) crWin = false; initDone = false; sharing = false; - clear_on_painter_begin = true; max_texture_size = -1; version_flags_cached = false; version_flags = QGLFormat::OpenGL_Version_None; @@ -4254,7 +4253,7 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, } else { setAutoBufferSwap(false); // disable glClear() as a result of QPainter::begin() - d->glcx->d_func()->clear_on_painter_begin = false; + d->disable_clear_on_painter_begin = true; if (engine->type() == QPaintEngine::OpenGL2) { qt_save_gl_state(); #ifndef QT_OPENGL_ES_2 @@ -4284,7 +4283,7 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, p->end(); delete p; setAutoBufferSwap(auto_swap); - d->glcx->d_func()->clear_on_painter_begin = true; + d->disable_clear_on_painter_begin = false; if (engine->type() == QPaintEngine::OpenGL2) qt_restore_gl_state(); } @@ -4427,7 +4426,7 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con } else { setAutoBufferSwap(false); // disable glClear() as a result of QPainter::begin() - d->glcx->d_func()->clear_on_painter_begin = false; + d->disable_clear_on_painter_begin = true; if (engine->type() == QPaintEngine::OpenGL2) qt_save_gl_state(); p = new QPainter(this); @@ -4467,7 +4466,7 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con if (engine->type() == QPaintEngine::OpenGL2) qt_restore_gl_state(); setAutoBufferSwap(auto_swap); - d->glcx->d_func()->clear_on_painter_begin = true; + d->disable_clear_on_painter_begin = false; } #ifndef QT_OPENGL_ES if (engine->type() == QPaintEngine::OpenGL2) |