Fix: Only flip video once for BottomToTop scanline directions
authorWouter Huysentruit <wouter.huysentruit@dzine.be>
Fri, 11 Jan 2013 10:20:06 +0000 (11:20 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 14 Jan 2013 08:05:15 +0000 (09:05 +0100)
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 <thomas.mcguire@kdab.com>
Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@gmail.com>
src/multimediawidgets/qpaintervideosurface.cpp

index d7f8a36..c678c23 100644 (file)
@@ -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();