summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/multimedia/base/qpaintervideosurface.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/multimedia/base/qpaintervideosurface.cpp b/src/multimedia/base/qpaintervideosurface.cpp
index b8028d8f..2fe941b 100644
--- a/src/multimedia/base/qpaintervideosurface.cpp
+++ b/src/multimedia/base/qpaintervideosurface.cpp
@@ -737,10 +737,15 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::paint(
const QRectF &target, QPainter *painter, const QRectF &source)
{
if (m_frame.isValid()) {
+ bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST);
+ bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST);
+
painter->beginNativePainting();
- glEnable(GL_STENCIL_TEST);
- glEnable(GL_SCISSOR_TEST);
+ if (stencilTestEnabled)
+ glEnable(GL_STENCIL_TEST);
+ if (scissorTestEnabled)
+ glEnable(GL_SCISSOR_TEST);
const float txLeft = source.left() / m_frameSize.width();
const float txRight = source.right() / m_frameSize.width();
@@ -815,9 +820,6 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::paint(
glDisableClientState(GL_VERTEX_ARRAY);
glDisable(GL_FRAGMENT_PROGRAM_ARB);
- glDisable(GL_STENCIL_TEST);
- glDisable(GL_SCISSOR_TEST);
-
painter->endNativePainting();
}
return QAbstractVideoSurface::NoError;
@@ -1063,10 +1065,15 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::paint(
const QRectF &target, QPainter *painter, const QRectF &source)
{
if (m_frame.isValid()) {
+ bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST);
+ bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST);
+
painter->beginNativePainting();
- glEnable(GL_STENCIL_TEST);
- glEnable(GL_SCISSOR_TEST);
+ if (stencilTestEnabled)
+ glEnable(GL_STENCIL_TEST);
+ if (scissorTestEnabled)
+ glEnable(GL_SCISSOR_TEST);
const int width = QGLContext::currentContext()->device()->width();
const int height = QGLContext::currentContext()->device()->height();
@@ -1158,9 +1165,6 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::paint(
m_program.release();
-
- glDisable(GL_SCISSOR_TEST);
- glDisable(GL_STENCIL_TEST);
painter->endNativePainting();
}
return QAbstractVideoSurface::NoError;