Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwasmoffscreensurface.cpp
Go to the documentation of this file.
1
// Copyright (C) 2019 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4
#include "
qwasmoffscreensurface.h
"
5
6
QT_BEGIN_NAMESPACE
7
8
QWasmOffscreenSurface::QWasmOffscreenSurface
(
QOffscreenSurface
*offscreenSurface)
9
:
QPlatformOffscreenSurface
(offscreenSurface), m_offscreenCanvas(
emscripten
::
val
::undefined())
10
{
11
const
auto
offscreenCanvasClass = emscripten::val::global(
"OffscreenCanvas"
);
12
// The OffscreenCanvas is not supported on some browsers, most notably on Safari.
13
if
(!offscreenCanvasClass)
14
return
;
15
16
m_offscreenCanvas = offscreenCanvasClass.new_(
offscreenSurface
->
size
().
width
(),
17
offscreenSurface
->
size
().
height
());
18
19
m_specialTargetId = std::string(
"!qtoffscreen_"
) + std::to_string(uintptr_t(
this
));
20
21
emscripten::val::module_property(
"specialHTMLTargets"
)
22
.set(m_specialTargetId, m_offscreenCanvas);
23
}
24
25
QWasmOffscreenSurface::~QWasmOffscreenSurface
()
26
{
27
emscripten::val::module_property(
"specialHTMLTargets"
).delete_(m_specialTargetId);
28
}
29
30
bool
QWasmOffscreenSurface::isValid
()
const
31
{
32
return
!m_offscreenCanvas.isNull() && !m_offscreenCanvas.isUndefined();
33
}
34
35
QT_END_NAMESPACE
QOffscreenSurface
\inmodule QtGui
Definition
qoffscreensurface.h:21
QOffscreenSurface::size
QSize size() const override
Returns the size of the offscreen surface.
Definition
qoffscreensurface.cpp:235
QPlatformOffscreenSurface
Definition
qplatformoffscreensurface.h:30
QPlatformOffscreenSurface::offscreenSurface
QOffscreenSurface * offscreenSurface() const
Definition
qplatformoffscreensurface.cpp:26
QSize::height
constexpr int height() const noexcept
Returns the height.
Definition
qsize.h:133
QSize::width
constexpr int width() const noexcept
Returns the width.
Definition
qsize.h:130
QWasmOffscreenSurface::isValid
bool isValid() const override
Returns true if the platform offscreen surface has been allocated.
Definition
qwasmoffscreensurface.cpp:30
QWasmOffscreenSurface::~QWasmOffscreenSurface
~QWasmOffscreenSurface() final
Definition
qwasmoffscreensurface.cpp:25
QWasmOffscreenSurface::QWasmOffscreenSurface
QWasmOffscreenSurface(QOffscreenSurface *offscreenSurface)
Definition
qwasmoffscreensurface.cpp:8
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1590
emscripten
Definition
qwasmwindowtreenode.h:9
val
GLuint GLfloat * val
Definition
qopenglext.h:1513
qwasmoffscreensurface.h
qtbase
src
plugins
platforms
wasm
qwasmoffscreensurface.cpp
Generated by
1.10.0