From 3cc41dc8cd0c3d1e0540f3f3e975d62a4dc89e9b Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 15 Feb 2010 10:48:28 +1000 Subject: Fix hue rotation in QPainterVideoSurface. --- src/multimedia/base/qpaintervideosurface.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/multimedia/base/qpaintervideosurface.cpp b/src/multimedia/base/qpaintervideosurface.cpp index 533ddee..f097db8 100644 --- a/src/multimedia/base/qpaintervideosurface.cpp +++ b/src/multimedia/base/qpaintervideosurface.cpp @@ -368,17 +368,17 @@ void QVideoSurfaceGLPainter::updateColors(int brightness, int contrast, int hue, const qreal cosH = qCos(M_PI * h); const qreal sinH = qSin(M_PI * h); - const qreal h11 = -0.4728 * cosH + 0.7954 * sinH + 1.4728; - const qreal h21 = -0.9253 * cosH - 0.0118 * sinH + 0.9523; - const qreal h31 = 0.4525 * cosH + 0.8072 * sinH - 0.4524; + const qreal h11 = 0.787 * cosH - 0.213 * sinH + 0.213; + const qreal h21 = -0.213 * cosH + 0.143 * sinH + 0.213; + const qreal h31 = -0.213 * cosH - 0.787 * sinH + 0.213; - const qreal h12 = 1.4728 * cosH - 1.3728 * sinH - 1.4728; - const qreal h22 = 1.9253 * cosH + 0.5891 * sinH - 0.9253; - const qreal h32 = -0.4525 * cosH - 1.9619 * sinH + 0.4525; + const qreal h12 = -0.715 * cosH - 0.715 * sinH + 0.715; + const qreal h22 = 0.285 * cosH + 0.140 * sinH + 0.715; + const qreal h32 = -0.715 * cosH + 0.715 * sinH + 0.715; - const qreal h13 = 1.4728 * cosH - 0.2181 * sinH - 1.4728; - const qreal h23 = 0.9253 * cosH + 1.1665 * sinH - 0.9253; - const qreal h33 = 0.5475 * cosH - 1.3846 * sinH + 0.4525; + const qreal h13 = -0.072 * cosH + 0.928 * sinH + 0.072; + const qreal h23 = -0.072 * cosH - 0.283 * sinH + 0.072; + const qreal h33 = 0.928 * cosH + 0.072 * sinH + 0.072; const qreal sr = (1.0 - s) * 0.3086; const qreal sg = (1.0 - s) * 0.6094; -- cgit v0.12 From ec2a1fc447112d7200a378d56cf83894cdd00653 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 15 Feb 2010 11:09:09 +1000 Subject: Extend hue rotation to a full 360 degrees. --- src/multimedia/base/qpaintervideosurface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/multimedia/base/qpaintervideosurface.cpp b/src/multimedia/base/qpaintervideosurface.cpp index f097db8..f451809 100644 --- a/src/multimedia/base/qpaintervideosurface.cpp +++ b/src/multimedia/base/qpaintervideosurface.cpp @@ -362,7 +362,7 @@ void QVideoSurfaceGLPainter::updateColors(int brightness, int contrast, int hue, { const qreal b = brightness / 200.0; const qreal c = contrast / 100.0 + 1.0; - const qreal h = hue / 200.0; + const qreal h = hue / 100.0; const qreal s = saturation / 100.0 + 1.0; const qreal cosH = qCos(M_PI * h); -- cgit v0.12 From a0839595a5738b4c9b3f2e80a8265df885d8d80c Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 15 Feb 2010 11:48:25 +1000 Subject: 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. --- src/multimedia/base/qgraphicsvideoitem.cpp | 6 +----- 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 #include #include - +#include 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; -- cgit v0.12