Add invertedY flag for surface
authorJørgen Lind <jorgen.lind@nokia.com>
Fri, 6 May 2011 08:30:15 +0000 (10:30 +0200)
committerJørgen Lind <jorgen.lind@nokia.com>
Fri, 6 May 2011 08:30:15 +0000 (10:30 +0200)
src/qt-compositor/compositor_api/waylandsurface.cpp
src/qt-compositor/compositor_api/waylandsurface.h
src/qt-compositor/compositor_api/waylandsurfaceitem.cpp
src/qt-compositor/compositor_api/waylandsurfaceitem.h
src/qt-compositor/hardware_integration/graphicshardwareintegration.h
src/qt-compositor/wayland_wrapper/wlsurface.cpp
src/qt-compositor/wayland_wrapper/wlsurface.h

index 5a37459..ccc938d 100644 (file)
@@ -25,6 +25,12 @@ WaylandSurface::Type WaylandSurface::type() const
     return d->surface->type();
 }
 
+bool WaylandSurface::isYInverted() const
+{
+    Q_D(const WaylandSurface);
+    return d->surface->isYInverted();
+}
+
 QRect WaylandSurface::geometry() const
 {
     Q_D(const WaylandSurface);
index 2cf71b6..b429190 100644 (file)
@@ -69,6 +69,7 @@ public:
     WaylandSurface(Wayland::Surface *surface);
 
     Type type() const;
+    bool isYInverted() const;
 
     void setGeometry(const QRect &geometry);
     QRect geometry() const;
index e9cce77..b10d219 100644 (file)
@@ -113,6 +113,11 @@ void WaylandSurfaceItem::setSurface(WaylandSurface *surface)
     init(surface);
 }
 
+bool WaylandSurfaceItem::isYInverted() const
+{
+    return m_surface->isYInverted();
+}
+
 QSGTexture *WaylandSurfaceItem::texture() const
 {
     if (m_texture)
index 50ca44e..acf0321 100644 (file)
@@ -63,6 +63,8 @@ public:
     void setSurface(WaylandSurface *surface);
     WaylandSurface *surface() const {return m_surface; }
 
+    Q_INVOKABLE bool isYInverted() const;
+
     QSGTexture *texture() const;
     const char *textureChangedSignal() const { return SIGNAL(textureChanged()); }
 
index 9ed793e..9fa574e 100644 (file)
@@ -58,6 +58,7 @@ public:
         so there is no need to do makeCurrent in this function.
      **/
     virtual GLuint createTextureFromBuffer(struct wl_buffer *buffer) = 0;
+    virtual bool isYInverted(struct wl_buffer *) const { return false; }
 
     virtual bool setDirectRenderSurface(WaylandSurface *) {return false;}
     virtual bool postBuffer(struct wl_buffer *) {return false;}
index 1fd77bc..c0eeace 100644 (file)
@@ -193,6 +193,15 @@ WaylandSurface::Type Surface::type() const
     return d->type();
 }
 
+bool Surface::isYInverted() const
+{
+    Q_D(const Surface);
+    if (d->type() == WaylandSurface::Texture) {
+        return d->compositor->graphicsHWIntegration()->isYInverted(d->buffer());
+    }
+    return false;
+}
+
 void Surface::damage(const QRect &rect)
 {
     Q_D(Surface);
index 8ebcd31..bcbd3e5 100644 (file)
@@ -71,6 +71,7 @@ public:
     ~Surface();
 
     WaylandSurface::Type type() const;
+    bool isYInverted() const;
 
     uint id() const { return base()->resource.object.id; }
     void attach(struct wl_buffer *buffer);