Add an interface to call damage on a wl_buffer
authorJørgen Lind <jorgen.lind@nokia.com>
Mon, 9 Jan 2012 07:56:35 +0000 (08:56 +0100)
committerSamuel Rødal <samuel.rodal@nokia.com>
Tue, 10 Jan 2012 12:13:23 +0000 (13:13 +0100)
Change-Id: Id3814572be31fc2e7812fea33e8ed21c53f2d6f1
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/plugins/platforms/wayland/qwaylandbuffer.h

index 119c2fa..880b566 100644 (file)
@@ -43,6 +43,7 @@
 #define QWAYLANDBUFFER_H
 
 #include <QtCore/QSize>
+#include <QtCore/QRect>
 
 #include <wayland-client.h>
 #include <wayland-client-protocol.h>
@@ -53,9 +54,18 @@ public:
     virtual ~QWaylandBuffer() { }
     wl_buffer *buffer() {return mBuffer;}
     virtual QSize size() const = 0;
+    inline void damage(const QRect &rect = QRect());
 
 protected:
     struct wl_buffer *mBuffer;
 };
 
+void QWaylandBuffer::damage(const QRect &rect)
+{
+    if (rect.isValid())
+        wl_buffer_damage(mBuffer,rect.x(),rect.y(),rect.width(),rect.height());
+    else
+        wl_buffer_damage(mBuffer,0,0,size().width(),size().height());
+}
+
 #endif // QWAYLANDBUFFER_H