summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2017-04-25 17:17:56 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2017-04-27 12:58:34 +0000
commit69bbd62a3c93f8142f57ad764db29ecaabbb0ff7 (patch)
treeed579754516c348c7eff65792c86196f22f01f66
parenta0c3d2c5863f379683e8cb3f0143c80cb9312c60 (diff)
Remove non-functional example
The server-buffer example does not work, and probably has not worked for a long time. This example was written for an early version of Wayland, and the APIs have changed since then. Change-Id: If647c7085aaaae87c06010bd28896fa8bfc4bdcc Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
-rw-r--r--examples/wayland/server-buffer/README17
-rw-r--r--examples/wayland/server-buffer/client/client.pro17
-rw-r--r--examples/wayland/server-buffer/client/main.cpp190
-rw-r--r--examples/wayland/server-buffer/client/serverbufferrenderer.cpp135
-rw-r--r--examples/wayland/server-buffer/client/serverbufferrenderer.h70
-rw-r--r--examples/wayland/server-buffer/compositor/compositor.pro20
-rw-r--r--examples/wayland/server-buffer/compositor/compositor.qrc7
-rw-r--r--examples/wayland/server-buffer/compositor/images/background.jpgbin30730 -> 0 bytes
-rw-r--r--examples/wayland/server-buffer/compositor/main.cpp259
-rw-r--r--examples/wayland/server-buffer/compositor/qml/ServerBufferContainer.qml75
-rw-r--r--examples/wayland/server-buffer/compositor/qml/main.qml83
-rw-r--r--examples/wayland/server-buffer/compositor/serverbufferitem.cpp126
-rw-r--r--examples/wayland/server-buffer/compositor/serverbufferitem.h99
-rw-r--r--examples/wayland/server-buffer/compositor/serverbuffertextureprovider.h77
-rw-r--r--examples/wayland/server-buffer/server-buffer.pro6
-rw-r--r--examples/wayland/server-buffer/share-buffer.xml46
-rw-r--r--examples/wayland/wayland.pro3
17 files changed, 1 insertions, 1229 deletions
diff --git a/examples/wayland/server-buffer/README b/examples/wayland/server-buffer/README
deleted file mode 100644
index 762db4238..000000000
--- a/examples/wayland/server-buffer/README
+++ /dev/null
@@ -1,17 +0,0 @@
-This is the example to demonstrate the server buffer interfaces
-
-Compile up both compositor and client.
-
-If you have the drm-egl-server buffer integration (and your running Mesa)
-then start the compositor with:
-
-# QT_WAYLAND_SERVER_BUFFER_INTEGRATION=drm-egl-server ./compositor
-
-The compositor is using the hardware integration extension to boradcast
-to all clients to use the same server buffer integration, so all you need
-to do is to start the client with
-
-# ./client -platform wayland
-
-You should then see a red box in top left corner, with a black cross and
-a horisontal line in the top half (centered).
diff --git a/examples/wayland/server-buffer/client/client.pro b/examples/wayland/server-buffer/client/client.pro
deleted file mode 100644
index 459a407a4..000000000
--- a/examples/wayland/server-buffer/client/client.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE = app
-TARGET = client
-INCLUDEPATH += .
-
-QT += waylandclient-private
-CONFIG += wayland-scanner
-WAYLANDCLIENTSOURCES += ../share-buffer.xml
-
-SOURCES += \
- main.cpp \
- serverbufferrenderer.cpp
-
-HEADERS += \
- serverbufferrenderer.h
-
-target.path = $$[QT_INSTALL_EXAMPLES]/wayland/server-buffer/client
-INSTALLS += target
diff --git a/examples/wayland/server-buffer/client/main.cpp b/examples/wayland/server-buffer/client/main.cpp
deleted file mode 100644
index bab4a942a..000000000
--- a/examples/wayland/server-buffer/client/main.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "serverbufferrenderer.h"
-
-#include <QtGui/QWindow>
-#include <QtGui/QGuiApplication>
-#include <QtGui/private/qguiapplication_p.h>
-#include <QtGui/qpa/qplatformnativeinterface.h>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLVertexArrayObject>
-#include <QtGui/QOpenGLShaderProgram>
-#include <QtGui/QOpenGLTexture>
-#include <QtCore/QTimer>
-
-#include "qwayland-share-buffer.h"
-#include <QtWaylandClient/private/qwayland-wayland.h>
-#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include <QtWaylandClient/private/qwaylandintegration_p.h>
-
-
-class Window
- : public QWindow
- , public QtWayland::wl_registry
- , public QtWayland::qt_share_buffer
-{
- Q_OBJECT
-public:
- Window(QWindow *parent = 0)
- : QWindow(parent)
- , m_context(0)
- {
- setSurfaceType(QSurface::OpenGLSurface);
- QSurfaceFormat sformat = format();
- sformat.setAlphaBufferSize(8);
- sformat.setRedBufferSize(8);
- sformat.setGreenBufferSize(8);
- sformat.setBlueBufferSize(8);
- setFormat(sformat);
- create();
-
- if (!QGuiApplication::platformNativeInterface() || !QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("wl_display")) {
- qDebug() << "This application requires a wayland plugin";
- QCoreApplication::quit();
- return;
- }
-
- QtWaylandClient::QWaylandIntegration *wayland_integration = static_cast<QtWaylandClient::QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration());
-
- m_server_buffer_integration = wayland_integration->serverBufferIntegration();
- if (!m_server_buffer_integration) {
- qDebug() << "This application requires a working serverBufferIntegration";
- QCoreApplication::quit();
- return;
- }
-
-
- QtWaylandClient::QWaylandDisplay *wayland_display = wayland_integration->display();
- struct ::wl_registry *registry = wl_display_get_registry(wayland_display->wl_display());
- QtWayland::wl_registry::init(registry);
- }
-
-public slots:
- void render()
- {
- if (m_server_buffer_list.isEmpty())
- return;
-
- if (!m_context) {
- m_context = new QOpenGLContext(this);
- m_context->setFormat(format());
- m_context->create();
- }
-
- m_context->makeCurrent(this);
- QOpenGLFunctions *funcs = m_context->functions();
- funcs->glBindFramebuffer(GL_FRAMEBUFFER, m_context->defaultFramebufferObject());
-
- glViewport(0, 0, width() * devicePixelRatio(), height() * devicePixelRatio());
- glClearColor(0.f, 0.f, 0.0f, 1.f);
- glClear(GL_COLOR_BUFFER_BIT);
-
- qreal x = 0;
- for (int i = 0; i < m_server_buffer_list.size(); i++) {
- ServerBufferRenderer *renderer = static_cast<ServerBufferRenderer *>(m_server_buffer_list[i]->userData());
- if (!renderer) {
- renderer = new ServerBufferRenderer(m_server_buffer_list.at(i));
- }
-
- const QSizeF buffer_size = m_server_buffer_list.at(i)->size();
- qreal scale_x = buffer_size.width() / width();
- qreal scale_y = buffer_size.height() / height() * - 1;
- qreal translate_left = (((buffer_size.width() / 2) / width()) * 2) - 1;
- qreal translate_top = -(((buffer_size.height() / 2) / height()) * 2) + 1;
- qreal translate_x = translate_left + ((x / width())*2);
-
- QMatrix4x4 transform;
- transform.translate(translate_x, translate_top);
- transform.scale(scale_x, scale_y);
- renderer->render(transform);
-
- x += buffer_size.width();
- }
-
- m_context->swapBuffers(this);
- }
-
-protected:
- void registry_global(uint32_t name, const QString &interface, uint32_t version) override
- {
- Q_UNUSED(version);
- if (interface == QStringLiteral("qt_share_buffer")) {
- QtWayland::qt_share_buffer::init(QtWayland::wl_registry::object(), name, 1);
- }
- }
-
- void share_buffer_cross_buffer(struct ::qt_server_buffer *buffer) override
- {
- QtWaylandClient::QWaylandServerBuffer *serverBuffer = m_server_buffer_integration->serverBuffer(buffer);
- if (m_server_buffer_list.isEmpty()) {
- setWidth(serverBuffer->size().width());
- setHeight(serverBuffer->size().height());
- } else {
- setWidth(width() + serverBuffer->size().width());
- setHeight(std::max(serverBuffer->size().height(), height()));
- }
- m_server_buffer_list.append(serverBuffer);
- render();
- }
-
-private:
- QtWaylandClient::QWaylandServerBufferIntegration *m_server_buffer_integration;
- QList<QtWaylandClient::QWaylandServerBuffer *>m_server_buffer_list;
- GLuint m_server_buffer_texture;
- QOpenGLContext *m_context;
- QOpenGLVertexArrayObject *m_vao;
- GLuint m_vertexbuffer;
- GLuint m_texture_coords;
- QOpenGLShaderProgram *m_shader_program;
- QOpenGLTexture *m_image_texture;
-};
-
-int main (int argc, char **argv)
-{
- QGuiApplication app(argc, argv);
-
- Window window;
- window.show();
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/examples/wayland/server-buffer/client/serverbufferrenderer.cpp b/examples/wayland/server-buffer/client/serverbufferrenderer.cpp
deleted file mode 100644
index 5c393e91c..000000000
--- a/examples/wayland/server-buffer/client/serverbufferrenderer.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "serverbufferrenderer.h"
-
-#include <QtGui/QOpenGLVertexArrayObject>
-#include <QtGui/QOpenGLShaderProgram>
-
-static const GLfloat uv_coords[] = {
- 0,0,
- 0,1,
- 1,0,
- 1,1,
-};
-
-static const GLfloat vertex_coords[] = {
- -1,-1,0,
- -1,1,0,
- 1,-1,0,
- 1,1,0,
-};
-
-static const char vertex_shader[] =
- "attribute vec3 vertexCoord;"
- "attribute vec2 textureCoord;"
- "uniform mat4 transform;"
- "varying mediump vec2 uv;"
- "void main() {"
- " uv = textureCoord;"
- " gl_Position = transform * vec4(vertexCoord,1);"
- "}";
-
-static const char fragment_shader[] =
- "varying mediump vec2 uv;"
- "uniform sampler2D textureSampler;"
- "void main() {"
- " gl_FragColor = texture2D(textureSampler, uv);"
- "}";
-
-ServerBufferRenderer::ServerBufferRenderer(QtWaylandClient::QWaylandServerBuffer *serverBuffer)
- : QOpenGLFunctions(QOpenGLContext::currentContext())
- , m_server_buffer(serverBuffer)
- , m_texture(0)
- , m_vao(new QOpenGLVertexArrayObject())
- , m_program(new QOpenGLShaderProgram())
- , m_vertexbuffer(0)
- , m_texture_coords(0)
-
-{
- Q_ASSERT(serverBuffer);
- if (serverBuffer->userData()) {
- qWarning("ServerBufferRenderer: Will over QWaylandServerBuffers %p userdata %p", serverBuffer, serverBuffer->userData());
- }
- serverBuffer->setUserData(this);
- m_vao->create();
- m_vao->bind();
-
- m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertex_shader);
- m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, fragment_shader);
- if (!m_program->link()) {
- qDebug() << m_program->log();
- }
-
- glGenTextures(1,&m_texture);
- glBindTexture(GL_TEXTURE_2D, m_texture);
- serverBuffer->bindTextureToBuffer();
-
- glGenBuffers(1, &m_vertexbuffer);
- glBindBuffer(GL_ARRAY_BUFFER, m_vertexbuffer);
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_coords), vertex_coords, GL_STATIC_DRAW);
- m_program->setAttributeBuffer("vertexCoord", GL_FLOAT, 0, 3, 0);
-
- glGenBuffers(1, &m_texture_coords);
- glBindBuffer(GL_ARRAY_BUFFER, m_texture_coords);
- glBufferData(GL_ARRAY_BUFFER, sizeof(uv_coords), uv_coords, GL_STATIC_DRAW);
- m_program->setAttributeBuffer("textureCoord", GL_FLOAT, 0, 2, 0);
-
- m_program->enableAttributeArray("vertexCoord");
- m_program->enableAttributeArray("textureCoord");
-
- m_vao->release();
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-}
-
-void ServerBufferRenderer::render(const QMatrix4x4 &transform)
-{
- m_vao->bind();
-
- m_program->bind();
- m_program->setUniformValue("transform", transform);
-
- glBindTexture(GL_TEXTURE_2D, m_texture);
-
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
- m_vao->release();
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-}
diff --git a/examples/wayland/server-buffer/client/serverbufferrenderer.h b/examples/wayland/server-buffer/client/serverbufferrenderer.h
deleted file mode 100644
index 146d3a99a..000000000
--- a/examples/wayland/server-buffer/client/serverbufferrenderer.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SERVERBUFFERRENDERER_H
-#define SERVERBUFFERRENDERER_H
-
-#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
-#include <QtGui/QOpenGLFunctions>
-#include <QMatrix4x4>
-QT_BEGIN_NAMESPACE
-
-class QOpenGLVertexArrayObject;
-class QOpenGLShaderProgram;
-
-class ServerBufferRenderer : public QOpenGLFunctions
-{
-public:
- ServerBufferRenderer(QtWaylandClient::QWaylandServerBuffer *serverBuffer);
-
- void render(const QMatrix4x4 &transform);
-private:
- QtWaylandClient::QWaylandServerBuffer *m_server_buffer;
- GLuint m_texture;
-
- QOpenGLVertexArrayObject *m_vao;
- QOpenGLShaderProgram *m_program;
-
- GLuint m_vertexbuffer;
- GLuint m_texture_coords;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/examples/wayland/server-buffer/compositor/compositor.pro b/examples/wayland/server-buffer/compositor/compositor.pro
deleted file mode 100644
index 45240af91..000000000
--- a/examples/wayland/server-buffer/compositor/compositor.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-QT += core-private gui-private quick-private waylandcompositor-private
-
-SOURCES += \
- main.cpp \
- serverbufferitem.cpp
-
-HEADERS += \
- serverbufferitem.h \
- serverbuffertextureprovider.h
-
-OTHER_FILES = \
- images/background.jpg
-
-RESOURCES += compositor.qrc
-
-CONFIG += wayland-scanner
-WAYLANDSERVERSOURCES += ../share-buffer.xml
-
-target.path = $$[QT_INSTALL_EXAMPLES]/wayland/server-buffer/compositor
-INSTALLS += target
diff --git a/examples/wayland/server-buffer/compositor/compositor.qrc b/examples/wayland/server-buffer/compositor/compositor.qrc
deleted file mode 100644
index dbbbfb1cf..000000000
--- a/examples/wayland/server-buffer/compositor/compositor.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>images/background.jpg</file>
- <file>qml/main.qml</file>
- <file>qml/ServerBufferContainer.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/wayland/server-buffer/compositor/images/background.jpg b/examples/wayland/server-buffer/compositor/images/background.jpg
deleted file mode 100644
index 445567fbd..000000000
--- a/examples/wayland/server-buffer/compositor/images/background.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/wayland/server-buffer/compositor/main.cpp b/examples/wayland/server-buffer/compositor/main.cpp
deleted file mode 100644
index 9ac91244e..000000000
--- a/examples/wayland/server-buffer/compositor/main.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandquickcompositor.h"
-#include "qwaylandsurface.h"
-#include "qwaylandquickitem.h"
-
-#include <QGuiApplication>
-#include <QTimer>
-#include <QPainter>
-#include <QMouseEvent>
-#include <QOpenGLContext>
-
-#include <QQmlContext>
-
-#include <QQuickItem>
-#include <QQuickView>
-
-#include "qwayland-server-share-buffer.h"
-#include <QtWaylandCompositor/QWaylandQuickOutput>
-#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/QWaylandQuickItem>
-#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
-#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
-
-#include "serverbufferitem.h"
-
-#include <QtGui/private/qdistancefield_p.h>
-
-class QmlCompositor
- : public QWaylandQuickCompositor
- , public QtWaylandServer::qt_share_buffer
-{
- Q_OBJECT
-
-public:
- QmlCompositor()
- : QWaylandQuickCompositor()
- , QtWaylandServer::qt_share_buffer(QWaylandCompositor::display(), 1)
- , m_server_buffer_32_bit(0)
- , m_server_buffer_item_32_bit(0)
- , m_server_buffer_8_bit(0)
- , m_server_buffer_item_8_bit(0)
- {
- create();
- m_view.setSource(QUrl("qrc:/qml/main.qml"));
- m_view.setResizeMode(QQuickView::SizeRootObjectToView);
- m_view.setColor(Qt::black);
- m_view.create();
- m_output = new QWaylandQuickOutput(this, &m_view);
- m_output->setSizeFollowsWindow(true);
-
- connect(&m_view, &QQuickView::afterRendering, this, &QmlCompositor::sendCallbacks);
-
- connect(&m_view, &QQuickView::sceneGraphInitialized, this, &QmlCompositor::initiateServerBuffer,Qt::DirectConnection);
- connect(this, &QmlCompositor::serverBuffersCreated, this, &QmlCompositor::createServerBufferItems);
-
- connect(this, SIGNAL(windowAdded(QVariant)), m_view.rootObject(), SLOT(windowAdded(QVariant)));
- connect(this, SIGNAL(windowResized(QVariant)), m_view.rootObject(), SLOT(windowResized(QVariant)));
- connect(this, SIGNAL(serverBufferItemCreated(QVariant)), m_view.rootObject(), SLOT(serverBufferItemCreated(QVariant)));
- connect(this, &QWaylandCompositor::surfaceCreated, this, &QmlCompositor::onSurfaceCreated);
-
- m_view.setTitle(QLatin1String("QML Compositor"));
- m_view.setGeometry(0, 0, 1024, 768);
- m_view.rootContext()->setContextProperty("compositor", this);
-
- m_view.show();
- }
-
- Q_INVOKABLE QWaylandQuickItem *item(QWaylandSurface *surf)
- {
- return static_cast<QWaylandQuickItem *>(surf->views().first()->renderObject());
- }
-
-signals:
- void windowAdded(QVariant window);
- void windowResized(QVariant window);
- void serverBufferItemCreated(QVariant);
- void serverBuffersCreated();
-
-public slots:
- void destroyClientForWindow(QVariant window)
- {
- QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(qvariant_cast<QObject *>(window));
- destroyClientForSurface(surface);
- }
-
-private slots:
- void surfaceMapped() {
- QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
- emit windowAdded(QVariant::fromValue(surface));
- }
-
- void sendCallbacks() {
- m_output->sendFrameCallbacks();
- }
-
- void initiateServerBuffer()
- {
- if (!QWaylandCompositorPrivate::get(this)->serverBufferIntegration())
- return;
-
- m_view.openglContext()->makeCurrent(&m_view);
-
- QtWayland::ServerBufferIntegration *sbi = QWaylandCompositorPrivate::get(this)->serverBufferIntegration();
- if (!sbi) {
- qWarning("Could not find a Server Buffer Integration");
- return;
- }
- if (sbi->supportsFormat(QtWayland::ServerBuffer::RGBA32)) {
- QImage image(100,100,QImage::Format_ARGB32_Premultiplied);
- image.fill(QColor(0x55,0x0,0x55,0x01));
- {
- QPainter p(&image);
- QPen pen = p.pen();
- pen.setWidthF(3);
- pen.setColor(Qt::red);
- p.setPen(pen);
- p.drawLine(0,0,100,100);
- pen.setColor(Qt::green);
- p.setPen(pen);
- p.drawLine(100,0,0,100);
- pen.setColor(Qt::blue);
- p.setPen(pen);
- p.drawLine(25,15,75,15);
- }
- image = image.convertToFormat(QImage::Format_RGBA8888);
-
- m_server_buffer_32_bit = sbi->createServerBuffer(image.size(),QtWayland::ServerBuffer::RGBA32);
-
- GLuint texture_32_bit;
- glGenTextures(1, &texture_32_bit);
- glBindTexture(GL_TEXTURE_2D, texture_32_bit);
- m_server_buffer_32_bit->bindTextureToBuffer();
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image.width(), image.height(), GL_RGBA, GL_UNSIGNED_BYTE, image.constBits());
- glBindTexture(GL_TEXTURE_2D, 0);
-
- glBindTexture(GL_TEXTURE_2D, 0);
- glDeleteTextures(1, &texture_32_bit);
-
- }
-
- if (sbi->supportsFormat(QtWayland::ServerBuffer::A8)) {
- QRawFont defaultRaw = QRawFont::fromFont(QFont(), QFontDatabase::Latin);
- QVector<quint32> index = defaultRaw.glyphIndexesForString(QStringLiteral("R"));
- QDistanceField distanceField(defaultRaw, index.front(), true);
- QImage img = distanceField.toImage(QImage::Format_Indexed8);
-
- m_server_buffer_8_bit = sbi->createServerBuffer(img.size(), QtWayland::ServerBuffer::A8);
- GLuint texture_8_bit;
- glGenTextures(1, &texture_8_bit);
- glBindTexture(GL_TEXTURE_2D, texture_8_bit);
- m_server_buffer_8_bit->bindTextureToBuffer();
-
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, img.width(), img.height(), GL_ALPHA, GL_UNSIGNED_BYTE, img.constBits());
- }
- emit serverBuffersCreated();
- }
-
- void createServerBufferItems()
- {
- if (m_server_buffer_32_bit) {
- m_server_buffer_item_32_bit = new ServerBufferItem(m_server_buffer_32_bit);
- m_server_buffer_item_32_bit->setUseTextureAlpha(true);
- emit serverBufferItemCreated(QVariant::fromValue(m_server_buffer_item_32_bit));
- }
- if (m_server_buffer_8_bit) {
- m_server_buffer_item_8_bit = new ServerBufferItem(m_server_buffer_8_bit);
- m_server_buffer_item_8_bit->setUseTextureAlpha(true);
- emit serverBufferItemCreated(QVariant::fromValue(m_server_buffer_item_8_bit));
- }
- }
-protected:
- void onSurfaceCreated(QWaylandSurface *surface) {
- QWaylandQuickItem *item = new QWaylandQuickItem();
- item->setSurface(surface);
- connect(surface, &QWaylandSurface::hasContentChanged, this, &QmlCompositor::surfaceMapped);
- }
-
- void share_buffer_bind_resource(Resource *resource) override
- {
- if (m_server_buffer_32_bit) {
- struct ::wl_client *client = resource->handle->client;
- struct ::wl_resource *buffer = m_server_buffer_32_bit->resourceForClient(client);
- send_cross_buffer(resource->handle, buffer);
-
- }
- if (m_server_buffer_8_bit) {
- struct ::wl_client *client = resource->handle->client;
- struct ::wl_resource *buffer = m_server_buffer_8_bit->resourceForClient(client);
- send_cross_buffer(resource->handle, buffer);
-
- }
- }
-
-private:
- QQuickView m_view;
- QWaylandOutput *m_output;
- QtWayland::ServerBuffer *m_server_buffer_32_bit;
- ServerBufferItem *m_server_buffer_item_32_bit;
- QtWayland::ServerBuffer *m_server_buffer_8_bit;
- ServerBufferItem *m_server_buffer_item_8_bit;
-};
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- if (app.arguments().contains(QStringLiteral("--invert"))) {
- qDebug() << "inverting";
- qputenv("QT_COMPOSITOR_NEGATE_INVERTED_Y", "1");
- }
-
- qmlRegisterType<ServerBufferItem>();
-
- QmlCompositor compositor;
-
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/examples/wayland/server-buffer/compositor/qml/ServerBufferContainer.qml b/examples/wayland/server-buffer/compositor/qml/ServerBufferContainer.qml
deleted file mode 100644
index e8ce19694..000000000
--- a/examples/wayland/server-buffer/compositor/qml/ServerBufferContainer.qml
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Item {
- id: container
-
- Item {
- id: bufferContainer
- property var serverBuffer
- property int depth: serverBuffer == null ? 0 : serverBuffer.depth
- width: serverBuffer == null ? 0 : serverBuffer.width
- height: serverBuffer == null ? 0 : serverBuffer.height
- }
-
- width: bufferContainer.width
- height: bufferContainer.height + text.height
-
- Rectangle {
- anchors.top: bufferContainer.bottom
- width: parent.width
- height: text.paintedHeight
- color: "light grey"
- Text {
- id: text
- anchors.fill: parent
- text: bufferContainer.depth == 8 ? "8 bit Server Side buffer" : "32 bit Server Side buffer\nHorizontal line should be blue"
- z: bufferContainer.z + 1
- wrapMode: Text.WordWrap
- }
- }
-
- function setServerBuffer(serverBuffer) {
- serverBuffer.parent = bufferContainer;
- bufferContainer.serverBuffer = serverBuffer
- }
-}
diff --git a/examples/wayland/server-buffer/compositor/qml/main.qml b/examples/wayland/server-buffer/compositor/qml/main.qml
deleted file mode 100644
index 55c0ffc13..000000000
--- a/examples/wayland/server-buffer/compositor/qml/main.qml
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtWayland.Compositor 1.0
-
-Item {
- id: root
-
- property var serverBufferContainerComponent : Qt.createComponent("qrc:/qml/ServerBufferContainer.qml")
-
- Image {
- id: background
- anchors.fill: parent
- fillMode: Image.Tile
- source: "qrc:/images/background.jpg"
- smooth: true
- }
-
- Row {
- id: row
- anchors.fill: parent
- }
-
- function windowAdded(window) {
- var item = compositor.item(window);
- item.parent = root;
- item.surfaceDestroyed.connect(item.destroy);
- }
-
- function windowResized(window) {
- }
-
- function removeWindow(window) {
- }
-
- function serverBufferItemCreated(serverBufferItem) {
- console.log("ServerBuffer item" + serverBufferItem);
- if (serverBufferContainerComponent.status != Component.Ready) {
- console.log("Error loading component:", component.errorString());
- return;
- }
- var container = serverBufferContainerComponent.createObject(row);
- container.setServerBuffer(serverBufferItem);
- }
-}
diff --git a/examples/wayland/server-buffer/compositor/serverbufferitem.cpp b/examples/wayland/server-buffer/compositor/serverbufferitem.cpp
deleted file mode 100644
index 4cf5f71ff..000000000
--- a/examples/wayland/server-buffer/compositor/serverbufferitem.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "serverbufferitem.h"
-
-#include "serverbuffertextureprovider.h"
-
-#include <QtQuick/QSGSimpleTextureNode>
-#include <QtQuick/QQuickWindow>
-
-#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
-
-QT_BEGIN_NAMESPACE
-
-ServerBufferItem::ServerBufferItem(QtWayland::ServerBuffer *serverBuffer, QQuickItem *parent)
- : QQuickItem(parent)
- , m_server_buffer(serverBuffer)
- , m_provider(new ServerBufferTextureProvider)
- , m_useTextureAlpha(false)
-{
- setFlag(QQuickItem::ItemHasContents);
- setWidth(serverBuffer->size().width());
- setHeight(serverBuffer->size().height());
- update();
-}
-
-ServerBufferItem::~ServerBufferItem()
-{
-}
-
-bool ServerBufferItem::isYInverted() const
-{
- return m_server_buffer->isYInverted();
-}
-
-int ServerBufferItem::depth() const
-{
- return m_server_buffer->format() == QtWayland::ServerBuffer::RGBA32 ? 32 : 8;
-}
-
-QSGTextureProvider *ServerBufferItem::textureProvider() const
-{
- return m_provider;
-}
-
-void ServerBufferItem::updateTexture()
-{
- if (m_provider->texture())
- return;
-
- QQuickWindow::CreateTextureOptions opt = QQuickWindow::TextureHasAlphaChannel;
- GLuint texture;
- glGenTextures(1,&texture);
- glBindTexture(GL_TEXTURE_2D, texture);
- m_server_buffer->bindTextureToBuffer();
- m_provider->setTexture(window()->createTextureFromId(texture, m_server_buffer->size(), opt));
-}
-
-QSGNode *ServerBufferItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
-{
- updateTexture();
- QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode *>(oldNode);
-
- if (!node) {
- node = new QSGSimpleTextureNode();
- }
-
- node->setTexture(m_provider->texture());
-
- if (isYInverted()) {
- node->setRect(0, height(), width(), -height());
- } else {
- node->setRect(0, 0, width(), height());
- }
-
- return node;
-}
-
-void ServerBufferItem::setUseTextureAlpha(bool useTextureAlpha)
-{
- m_useTextureAlpha = useTextureAlpha;
-
- if ((flags() & ItemHasContents) != 0) {
- update();
- }
-}
-
-QT_END_NAMESPACE
-
diff --git a/examples/wayland/server-buffer/compositor/serverbufferitem.h b/examples/wayland/server-buffer/compositor/serverbufferitem.h
deleted file mode 100644
index 3add52c49..000000000
--- a/examples/wayland/server-buffer/compositor/serverbufferitem.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SERVERBUFFERITEM_H
-#define SERVERBUFFERITEM_H
-
-#include <QtQuick/QQuickItem>
-#include <QtQuick/qsgtexture.h>
-
-#include <QtQuick/qsgtextureprovider.h>
-
-QT_BEGIN_NAMESPACE
-
-class ServerBufferTextureProvider;
-
-namespace QtWayland {
-class ServerBuffer;
-}
-
-class ServerBufferItem : public QQuickItem
-{
- Q_OBJECT
- Q_PROPERTY(QtWayland::ServerBuffer *serverBuffer READ serverBuffer CONSTANT)
- Q_PROPERTY(bool useTextureAlpha READ useTextureAlpha WRITE setUseTextureAlpha NOTIFY useTextureAlphaChanged)
- Q_PROPERTY(bool isYInverted READ isYInverted NOTIFY yInvertedChanged)
- Q_PROPERTY(int depth READ depth CONSTANT)
-
-public:
- ServerBufferItem(QtWayland::ServerBuffer *serverBuffer, QQuickItem *parent = 0);
- ~ServerBufferItem();
-
- QtWayland::ServerBuffer *serverBuffer() const { return m_server_buffer; }
-
- bool isYInverted() const;
- int depth() const;
-
- bool isTextureProvider() const { return true; }
- QSGTextureProvider *textureProvider() const;
-
- bool useTextureAlpha() const { return m_useTextureAlpha; }
- void setUseTextureAlpha(bool useTextureAlpha);
-
- void setDamagedFlag(bool on);
-
-signals:
- void useTextureAlphaChanged();
- void yInvertedChanged();
- void serverBufferChanged();
-
-protected:
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *);
-
-private:
- void updateTexture();
- QtWayland::ServerBuffer *m_server_buffer;
- ServerBufferTextureProvider *m_provider;
- bool m_useTextureAlpha;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/examples/wayland/server-buffer/compositor/serverbuffertextureprovider.h b/examples/wayland/server-buffer/compositor/serverbuffertextureprovider.h
deleted file mode 100644
index c94a34e2e..000000000
--- a/examples/wayland/server-buffer/compositor/serverbuffertextureprovider.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SERVERBUFFERTEXTUREPROVIDER_H
-#define SERVERBUFFERTEXTUREPROVIDER_H
-
-#include <QtQuick/QSGTextureProvider>
-
-QT_BEGIN_NAMESPACE
-
-class ServerBufferTextureProvider : public QSGTextureProvider
-{
-public:
- ServerBufferTextureProvider() : t(0) { }
- ~ServerBufferTextureProvider() { delete t; }
-
- QSGTexture *texture() const {
- if (t) {
- t->setHorizontalWrapMode(QSGTexture::ClampToEdge);
- t->setVerticalWrapMode(QSGTexture::ClampToEdge);
- t->setFiltering(QSGTexture::Linear);
- }
- return t;
- }
-
- void setTexture(QSGTexture *texture) {
- if (texture != t) {
- t = texture;
- emit textureChanged();
- }
- }
-
- bool smooth;
-private:
- QSGTexture *t;
-};
-
-QT_END_NAMESPACE
-
-#endif //SERVERBUFFERTEXTUREPROVIDER_H
diff --git a/examples/wayland/server-buffer/server-buffer.pro b/examples/wayland/server-buffer/server-buffer.pro
deleted file mode 100644
index 2f5f32b6d..000000000
--- a/examples/wayland/server-buffer/server-buffer.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-TEMPLATE=subdirs
-
-SUBDIRS += client compositor
-
-EXAMPLE_FILES += \
- share-buffer.xml
diff --git a/examples/wayland/server-buffer/share-buffer.xml b/examples/wayland/server-buffer/share-buffer.xml
deleted file mode 100644
index ceb6b11fd..000000000
--- a/examples/wayland/server-buffer/share-buffer.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<protocol name="share_buffer">
-
- <copyright>
- Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
- </copyright>
-
- <interface name="qt_share_buffer" version="1">
- <event name="cross_buffer">
- <arg name="buffer" type="object" interface="qt_server_buffer"/>
- </event>
- </interface>
-</protocol>
diff --git a/examples/wayland/wayland.pro b/examples/wayland/wayland.pro
index 6024dd2dd..876785808 100644
--- a/examples/wayland/wayland.pro
+++ b/examples/wayland/wayland.pro
@@ -15,7 +15,6 @@ qtHaveModule(quick) {
SUBDIRS += ivi-compositor
qtHaveModule(waylandclient) {
SUBDIRS += \
- custom-extension \
- server-buffer
+ custom-extension
}
}