summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp28
1 files changed, 2 insertions, 26 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 8fee83d..fcfd818 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1318,13 +1318,6 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->ctx = d->device->context();
- if (d->ctx->d_ptr->active_engine) {
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(d->ctx->d_ptr->active_engine);
- QGL2PaintEngineExPrivate *p = static_cast<QGL2PaintEngineExPrivate *>(engine->d_ptr.data());
- p->transferMode(BrushDrawingMode);
- p->device->context()->doneCurrent();
- }
-
d->ctx->d_ptr->active_engine = this;
d->last_created_state = 0;
@@ -1397,15 +1390,6 @@ bool QGL2PaintEngineEx::end()
{
Q_D(QGL2PaintEngineEx);
QGLContext *ctx = d->ctx;
- if (ctx->d_ptr->active_engine != this) {
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(ctx->d_ptr->active_engine);
- if (engine && engine->isActive()) {
- QGL2PaintEngineExPrivate *p = static_cast<QGL2PaintEngineExPrivate *>(engine->d_ptr.data());
- p->transferMode(BrushDrawingMode);
- p->device->context()->doneCurrent();
- }
- d->device->context()->makeCurrent();
- }
glUseProgram(0);
d->transferMode(BrushDrawingMode);
@@ -1435,20 +1419,12 @@ void QGL2PaintEngineEx::ensureActive()
QGLContext *ctx = d->ctx;
if (isActive() && ctx->d_ptr->active_engine != this) {
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(ctx->d_ptr->active_engine);
- if (engine && engine->isActive()) {
- QGL2PaintEngineExPrivate *p = static_cast<QGL2PaintEngineExPrivate *>(engine->d_ptr.data());
- p->transferMode(BrushDrawingMode);
- p->device->context()->doneCurrent();
- }
- d->device->context()->makeCurrent();
-
ctx->d_ptr->active_engine = this;
d->needsSync = true;
- } else {
- d->device->context()->makeCurrent();
}
+ d->device->ensureActiveTarget();
+
if (d->needsSync) {
glViewport(0, 0, d->width, d->height);
glDepthMask(false);