The texture node already flips, so we need to flip again
authorGunnar Sletta <gunnar.sletta@nokia.com>
Tue, 26 Apr 2011 09:54:05 +0000 (11:54 +0200)
committerGunnar Sletta <gunnar.sletta@nokia.com>
Tue, 26 Apr 2011 09:54:05 +0000 (11:54 +0200)
src/qt-compositor/compositor_api/waylandsurfaceitem.cpp
src/qt-compositor/compositor_api/waylandsurfaceitem.h

index 149dde8..e9cce77 100644 (file)
@@ -58,8 +58,10 @@ void WaylandSurfaceItem::surfaceDamaged(const QRect &)
         //qDebug() << "createTextureFromId" << m_surface->texture() << m_surface->geometry().size();
         m_texture = canvas()->sceneGraphEngine()->createTextureFromId(m_surface->texture(),
                                                                       m_surface->geometry().size());
+        m_texture_needs_flipping = true;
     } else {
         m_texture = canvas()->sceneGraphEngine()->createTextureFromImage(m_surface->image());
+        m_texture_needs_flipping = false;
     }
 
     emit textureChanged();
@@ -69,6 +71,7 @@ WaylandSurfaceItem::WaylandSurfaceItem(QSGItem *parent)
     : QSGItem(parent)
     , m_surface(0)
     , m_texture(0)
+    , m_texture_needs_flipping(false)
 {
 }
 
@@ -76,6 +79,7 @@ WaylandSurfaceItem::WaylandSurfaceItem(WaylandSurface *surface, QSGItem *parent)
     : QSGItem(parent)
     , m_surface(0)
     , m_texture(0)
+    , m_texture_needs_flipping(false)
 {
     init(surface);
 }
@@ -184,7 +188,11 @@ QSGNode *WaylandSurfaceItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
     }
     node->setTexture(m_texture);
 
-    node->setRect(QRectF(0, 0, width(), height()));
+    if (m_texture_needs_flipping)
+        node->setRect(0, height(), width(), -height());
+    else
+        node->setRect(0, 0, width(), height());
+
     node->setFiltering(smooth() ? QSGTexture::Linear : QSGTexture::Nearest);
 
     return node;
index 0bb4b29..50ca44e 100644 (file)
@@ -94,6 +94,8 @@ private:
 
     WaylandSurface *m_surface;
     QSGTexture *m_texture;
+
+    bool m_texture_needs_flipping;
 };
 
 #endif