diff options
author | Jorgen Lind <jorgen.lind@digia.com> | 2013-12-17 15:27:59 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-27 22:37:38 +0100 |
commit | eb40ab5af6e85767b4dbff9fa1bf21f6ad20ad37 (patch) | |
tree | 7f32434a460ba0bd6cf21d8639a716bf42d37186 /src | |
parent | 62568606a22ab9a6742a196956577356c0e10656 (diff) |
update server buffer interfaces
Change-Id: Ifc10b17deedc800167f3d03b2e4437e6b702ffa5
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src')
4 files changed, 84 insertions, 27 deletions
diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/client/hardwareintegration/qwaylandserverbufferintegration.cpp index 66fec00ea..9b4174d31 100644 --- a/src/client/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/client/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -1,5 +1,31 @@ #include "qwaylandserverbufferintegration.h" +QT_BEGIN_NAMESPACE + +QWaylandServerBuffer::QWaylandServerBuffer() + : m_user_data(0) +{ +} + +QWaylandServerBuffer::~QWaylandServerBuffer() +{ +} + +void QWaylandServerBuffer::setUserData(void *userData) +{ + m_user_data = userData; +} + +void *QWaylandServerBuffer::userData() const +{ + return m_user_data; +} + +QWaylandServerBuffer::Format QWaylandServerBuffer::format() const +{ + return m_format; +} + QWaylandServerBufferIntegration::QWaylandServerBufferIntegration() { } @@ -7,3 +33,4 @@ QWaylandServerBufferIntegration::~QWaylandServerBufferIntegration() { } +QT_END_NAMESPACE diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegration.h b/src/client/hardwareintegration/qwaylandserverbufferintegration.h index 0bb8a6ebc..fcb92aecd 100644 --- a/src/client/hardwareintegration/qwaylandserverbufferintegration.h +++ b/src/client/hardwareintegration/qwaylandserverbufferintegration.h @@ -51,6 +51,32 @@ QT_BEGIN_NAMESPACE class QWaylandDisplay; +class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBuffer +{ +public: + enum Format { + RGBA32, + A8 + }; + + QWaylandServerBuffer(); + virtual ~QWaylandServerBuffer(); + + //creates new texture for buffer + virtual GLuint createTexture() = 0; + + void setUserData(void *userData); + void *userData() const; + + Format format() const; + +protected: + Format m_format; + +private: + void *m_user_data; +}; + class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegration { public: @@ -59,13 +85,7 @@ public: virtual void initialize(QWaylandDisplay *display) = 0; - //creates new texture for buffer - virtual GLuint createTextureFor(struct qt_server_buffer *buffer) = 0; - - //does not clean up textures. Just lets server know that it does - //not intend to use the buffer anymore. Textures should have been - //deleted prior to calling this function - virtual void release(struct qt_server_buffer *buffer) = 0; + virtual QWaylandServerBuffer *serverBuffer(struct qt_server_buffer *buffer) = 0; }; QT_END_NAMESPACE diff --git a/src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp b/src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp index df5644163..8c742a847 100644 --- a/src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp +++ b/src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp @@ -40,28 +40,26 @@ #include "qwaylandserverbufferintegration.h" -QWaylandServerBuffer::QWaylandServerBuffer() +QT_BEGIN_NAMESPACE + +QWaylandServerBuffer::QWaylandServerBuffer(const QSize &size, QWaylandServerBuffer::Format format) + : m_size(size) + , m_format(format) { } QWaylandServerBuffer::~QWaylandServerBuffer() { } -void QWaylandServerBuffer::sendToClient(struct ::wl_client *) -{ } -GLuint QWaylandServerBuffer::createTexture(QOpenGLContext *) +bool QWaylandServerBuffer::isYInverted() const { - return 0; -} - -bool QWaylandServerBuffer::isYInverted(struct ::wl_resource *) const -{ - return true; + return false; } QSize QWaylandServerBuffer::size() const -{ - return QSize(); -} +{ return m_size; } + +QWaylandServerBuffer::Format QWaylandServerBuffer::format() const +{ return m_format; } QWaylandServerBufferIntegration::QWaylandServerBufferIntegration() { } @@ -74,8 +72,11 @@ void QWaylandServerBufferIntegration::initializeHardware(QWaylandCompositor *com Q_UNUSED(compositor); } -QWaylandServerBuffer *QWaylandServerBufferIntegration::createServerBuffer() +QWaylandServerBuffer *QWaylandServerBufferIntegration::createServerBuffer(const QSize &size, QWaylandServerBuffer::Format format) { + Q_UNUSED(size); + Q_UNUSED(format); return 0; } +QT_END_NAMESPACE diff --git a/src/compositor/hardware_integration/qwaylandserverbufferintegration.h b/src/compositor/hardware_integration/qwaylandserverbufferintegration.h index 8de519816..35614d513 100644 --- a/src/compositor/hardware_integration/qwaylandserverbufferintegration.h +++ b/src/compositor/hardware_integration/qwaylandserverbufferintegration.h @@ -61,15 +61,24 @@ namespace QtWayland { class Q_COMPOSITOR_EXPORT QWaylandServerBuffer { public: - QWaylandServerBuffer(); + enum Format { + RGBA32, + A8 + }; + + QWaylandServerBuffer(const QSize &size, QWaylandServerBuffer::Format format); virtual ~QWaylandServerBuffer(); - virtual void sendToClient(struct ::wl_client *); + virtual struct ::wl_resource *resourceForClient(struct ::wl_client *) = 0; - virtual GLuint createTexture(QOpenGLContext *); - virtual bool isYInverted(struct ::wl_resource *) const; + virtual GLuint createTexture() = 0; + virtual bool isYInverted() const; - virtual QSize size() const; + QSize size() const; + Format format() const; +protected: + QSize m_size; + Format m_format; }; class Q_COMPOSITOR_EXPORT QWaylandServerBufferIntegration @@ -80,7 +89,7 @@ public: virtual void initializeHardware(QWaylandCompositor *); - virtual QWaylandServerBuffer *createServerBuffer(); + virtual QWaylandServerBuffer *createServerBuffer(const QSize &size, QWaylandServerBuffer::Format format); }; QT_END_NAMESPACE |