summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSamuel Rødal <srodal@gmail.com>2014-11-04 20:24:38 +0100
committerSamuel Rødal <srodal@gmail.com>2014-11-11 19:24:34 +0100
commitf79d96b486c1dd50876001b9c3f65d103e07a18c (patch)
tree1326b56f3f1150edd20378aa05042e7e439a4b65 /tests
parenta4428d480b96d51f9979d45044f26c99fa82f465 (diff)
Fixed QtGui's GL paint engine getting out of sync when using QtOpenGL
We need to reset the active_engine belonging to QOpenGLContext whenever we make the QtOpenGL paint engine active, to give the OpenGL paint engine in QtGui a chance to sync its state if we've used the QtOpenGL paint engine inbetween. Change-Id: I445ce2f99bfbacf55650c881c4fdf07f2ff85069 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index d8ad3e1470..56198ceb65 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -1200,6 +1200,33 @@ void tst_QGL::currentFboSync()
QCOMPARE(fbo1.toImage(), fbo2Image);
}
+
+ {
+ QGLFramebufferObject fbo1(512, 512, QGLFramebufferObject::CombinedDepthStencil);
+
+ QOpenGLFramebufferObjectPaintDevice fbo2(256, 256);
+
+ QImage sourceImage(256, 256, QImage::Format_ARGB32_Premultiplied);
+ QPainter sourcePainter(&sourceImage);
+ qt_opengl_draw_test_pattern(&sourcePainter, 256, 256);
+
+ QPainter fbo2Painter(&fbo2);
+ fbo2Painter.drawImage(0, 0, sourceImage);
+ QImage fbo2Image1 = fbo2.toImage();
+ fbo2Painter.fillRect(0, 0, 256, 256, Qt::white);
+
+ QPainter fbo1Painter(&fbo1);
+ fbo1Painter.drawImage(0, 0, sourceImage);
+ fbo1Painter.end();
+
+ // check that the OpenGL paint engine now knows it needs to sync
+ fbo2Painter.drawImage(0, 0, sourceImage);
+ QImage fbo2Image2 = fbo2.toImage();
+
+ fbo2Painter.end();
+
+ QCOMPARE(fbo2Image1, fbo2Image2);
+ }
}
// Tests multiple QPainters active on different FBOs at the same time, with