From 9a9293df5a439c4b8e0826c9497948fdf0a05bcf Mon Sep 17 00:00:00 2001 From: Wouter Huysentruit Date: Fri, 11 Jan 2013 11:20:06 +0100 Subject: [PATCH] Fix: Only flip video once for BottomToTop scanline directions Top & bottom of the texture coordinates are already flipped for BottomToTop scanline directions. So there is no need to flip top & bottom of the vertex coordinates too. Change-Id: I221b94afb65c194bdedb787414e6a436b8095fb2 Reviewed-by: Thomas McGuire Reviewed-by: Dmytro Poplavskiy --- .../qpaintervideosurface.cpp | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/multimediawidgets/qpaintervideosurface.cpp b/src/multimediawidgets/qpaintervideosurface.cpp index d7f8a368..c678c230 100644 --- a/src/multimediawidgets/qpaintervideosurface.cpp +++ b/src/multimediawidgets/qpaintervideosurface.cpp @@ -864,19 +864,12 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::paint( txRight, txTop }; - const GLfloat vTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.top() - : target.bottom() + 1; - const GLfloat vBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.bottom() + 1 - : target.top(); - const GLfloat v_array[] = { - GLfloat(target.left()) , GLfloat(vBottom), - GLfloat(target.right() + 1), GLfloat(vBottom), - GLfloat(target.left()) , GLfloat(vTop), - GLfloat(target.right() + 1), GLfloat(vTop) + GLfloat(target.left()) , GLfloat(target.bottom() + 1), + GLfloat(target.right() + 1), GLfloat(target.bottom() + 1), + GLfloat(target.left()) , GLfloat(target.top()), + GLfloat(target.right() + 1), GLfloat(target.top()) }; glEnable(GL_FRAGMENT_PROGRAM_ARB); @@ -1231,20 +1224,12 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::paint( } }; - const GLfloat vTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.top() - : target.bottom() + 1; - const GLfloat vBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.bottom() + 1 - : target.top(); - - const GLfloat vertexCoordArray[] = { - GLfloat(target.left()) , GLfloat(vBottom), - GLfloat(target.right() + 1), GLfloat(vBottom), - GLfloat(target.left()) , GLfloat(vTop), - GLfloat(target.right() + 1), GLfloat(vTop) + GLfloat(target.left()) , GLfloat(target.bottom() + 1), + GLfloat(target.right() + 1), GLfloat(target.bottom() + 1), + GLfloat(target.left()) , GLfloat(target.top()), + GLfloat(target.right() + 1), GLfloat(target.top()) }; const GLfloat txLeft = source.left() / m_frameSize.width();