summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-03-31 00:40:42 (GMT)
committerDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-03-31 00:40:42 (GMT)
commitffb3275775874a94a6882d5098ac963ad54c9bec (patch)
tree9f4e425990b6255886b86b76837bac3feb163e88
parentae305abfdb795b472b2b9d200bf3b11af00d7d1f (diff)
downloadQt-ffb3275775874a94a6882d5098ac963ad54c9bec.zip
Qt-ffb3275775874a94a6882d5098ac963ad54c9bec.tar.gz
Qt-ffb3275775874a94a6882d5098ac963ad54c9bec.tar.bz2
Fixed incorrectly clipped video when rendered on QGLWidget
Don't enable GL stencil/scissor test inside of native GL rendering block if it was not enabled by QPaintEngine (QGLWidget viewport case). Reviewed-by: Andrew den Exter
-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;