diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-02-15 01:48:25 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-02-15 01:48:25 (GMT) |
commit | a0839595a5738b4c9b3f2e80a8265df885d8d80c (patch) | |
tree | 1629bc0a44b8088c9d435aa07983e2b711a09ac6 /src/multimedia | |
parent | ec2a1fc447112d7200a378d56cf83894cdd00653 (diff) | |
download | Qt-a0839595a5738b4c9b3f2e80a8265df885d8d80c.zip Qt-a0839595a5738b4c9b3f2e80a8265df885d8d80c.tar.gz Qt-a0839595a5738b4c9b3f2e80a8265df885d8d80c.tar.bz2 |
Fix flickering when items are overlaid on QGraphicsVideoItem.
Re-enable scissor and stencil tests so the texture frame is clipped
correctly. Otherwise when an overlaid item is updated the entire frame
will be redrawn not just the part intersecting the updated item,
resulting in other items being drawn over.
Diffstat (limited to 'src/multimedia')
-rw-r--r-- | src/multimedia/base/qgraphicsvideoitem.cpp | 6 | ||||
-rw-r--r-- | src/multimedia/base/qpaintervideosurface.cpp | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/multimedia/base/qgraphicsvideoitem.cpp b/src/multimedia/base/qgraphicsvideoitem.cpp index 8aba269..85369db 100644 --- a/src/multimedia/base/qgraphicsvideoitem.cpp +++ b/src/multimedia/base/qgraphicsvideoitem.cpp @@ -47,7 +47,7 @@ #include <QtMultimedia/qvideooutputcontrol.h> #include <QtMultimedia/qvideorenderercontrol.h> #include <QtMultimedia/qvideosurfaceformat.h> - +#include <QtOpenGL/qgl.h> QT_BEGIN_NAMESPACE @@ -384,9 +384,6 @@ void QGraphicsVideoItem::paint( if (d->surface && d->surface->isActive()) { d->surface->paint(painter, d->boundingRect, d->sourceRect); d->surface->setReady(true); -#ifndef QGRAPHICSVIDEOITEM_SHADERS // Flickers - } -#else } else if (d->updatePaintDevice && (painter->paintEngine()->type() == QPaintEngine::OpenGL || painter->paintEngine()->type() == QPaintEngine::OpenGL2)) { d->updatePaintDevice = false; @@ -398,7 +395,6 @@ void QGraphicsVideoItem::paint( d->surface->setShaderType(QPainterVideoSurface::FragmentProgramShader); } } -#endif } /*! diff --git a/src/multimedia/base/qpaintervideosurface.cpp b/src/multimedia/base/qpaintervideosurface.cpp index f451809..f7ffb02 100644 --- a/src/multimedia/base/qpaintervideosurface.cpp +++ b/src/multimedia/base/qpaintervideosurface.cpp @@ -982,6 +982,9 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::paint( if (m_frame.isValid()) { painter->beginNativePainting(); + glEnable(GL_STENCIL_TEST); + glEnable(GL_SCISSOR_TEST); + const int width = QGLContext::currentContext()->device()->width(); const int height = QGLContext::currentContext()->device()->height(); @@ -1072,6 +1075,9 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::paint( m_program.release(); + + glDisable(GL_SCISSOR_TEST); + glDisable(GL_STENCIL_TEST); painter->endNativePainting(); } return QAbstractVideoSurface::NoError; |