wasm: add QWasmOffscreenSurface

This no-op implementation is sufficient to support OpenGL cleanup
use cases, where the OpenGL context needs to be made current at times
where we don't have a window available.

A specific requirement on WebAssembly is that the context is tied
to one specific screen; which is an extra requirement on QWasmOffscreenSurface,
compared to the other platforms.

Task-number: QTBUG-75463
Change-Id: Ie3658cb235bf342be66f19dfe981e3a56a90e1b6
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Morten Johan Sørvig 2019-04-29 01:11:25 +02:00 committed by Jani Heikkinen
parent 00de44701d
commit 4e0f262892
5 changed files with 101 additions and 2 deletions

View File

@ -35,6 +35,7 @@
#include "qwasmtheme.h"
#include "qwasmclipboard.h"
#include "qwasmservices.h"
#include "qwasmoffscreensurface.h"
#include "qwasmwindow.h"
#ifndef QT_NO_OPENGL
@ -188,6 +189,11 @@ QPlatformOpenGLContext *QWasmIntegration::createPlatformOpenGLContext(QOpenGLCon
}
#endif
QPlatformOffscreenSurface *QWasmIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
{
return new QWasmOffscrenSurface(surface);
}
QPlatformFontDatabase *QWasmIntegration::fontDatabase() const
{
if (m_fontDb == nullptr)

View File

@ -65,6 +65,7 @@ public:
#ifndef QT_NO_OPENGL
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
#endif
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
QPlatformFontDatabase *fontDatabase() const override;
QAbstractEventDispatcher *createEventDispatcher() const override;
QVariant styleHint(QPlatformIntegration::StyleHint hint) const override;

View File

@ -0,0 +1,41 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qwasmoffscreensurface.h"
QWasmOffscrenSurface::QWasmOffscrenSurface(QOffscreenSurface *offscreenSurface)
:QPlatformOffscreenSurface(offscreenSurface)
{
}
QWasmOffscrenSurface::~QWasmOffscrenSurface()
{
}

View File

@ -0,0 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWASMOFFSCREENSURFACE_H
#define QWASMOFFSCREENSURFACE_H
#include <qpa/qplatformoffscreensurface.h>
QT_BEGIN_NAMESPACE
class QOffscreenSurface;
class QWasmOffscrenSurface : public QPlatformOffscreenSurface
{
public:
explicit QWasmOffscrenSurface(QOffscreenSurface *offscreenSurface);
~QWasmOffscrenSurface();
private:
};
QT_END_NAMESPACE
#endif

View File

@ -20,7 +20,8 @@ SOURCES = \
qwasmopenglcontext.cpp \
qwasmtheme.cpp \
qwasmclipboard.cpp \
qwasmservices.cpp
qwasmservices.cpp \
qwasmoffscreensurface.cpp
HEADERS = \
qwasmintegration.h \
@ -35,7 +36,8 @@ HEADERS = \
qwasmopenglcontext.h \
qwasmtheme.h \
qwasmclipboard.h \
qwasmservices.h
qwasmservices.h \
qwasmoffscreensurface.h
wasmfonts.files = \
../../../3rdparty/wasm/Vera.ttf \