Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant reason:default
4
5
#
include
"qwasmoffscreensurface.h"
6
7
QT_BEGIN_NAMESPACE
8
9
QWasmOffscreenSurface::QWasmOffscreenSurface(
QOffscreenSurface
*
offscreenSurface
)
10
: QPlatformOffscreenSurface(offscreenSurface), m_offscreenCanvas(emscripten::val::undefined())
11
{
12
const
auto
offscreenCanvasClass = emscripten::val::global(
"OffscreenCanvas"
);
13
// The OffscreenCanvas is not supported on some browsers, most notably on Safari.
14
if
(!offscreenCanvasClass)
15
return
;
16
17
m_offscreenCanvas = offscreenCanvasClass.new_(offscreenSurface->size().width(),
18
offscreenSurface->size().height());
19
20
m_specialTargetId = std::string(
"!qtoffscreen_"
) + std::to_string(uintptr_t(
this
));
21
22
emscripten::val::module_property(
"specialHTMLTargets"
)
23
.set(m_specialTargetId, m_offscreenCanvas);
24
}
25
26
QWasmOffscreenSurface::~
QWasmOffscreenSurface
()
27
{
28
emscripten::val::module_property(
"specialHTMLTargets"
).delete_(m_specialTargetId);
29
}
30
31
bool
QWasmOffscreenSurface::
isValid
()
const
32
{
33
return
!m_offscreenCanvas.isNull() && !m_offscreenCanvas.isUndefined();
34
}
35
36
QT_END_NAMESPACE
QOffscreenSurface
\inmodule QtGui
Definition
qoffscreensurface.h:22
QWasmOffscreenSurface::isValid
bool isValid() const override
Returns true if the platform offscreen surface has been allocated.
Definition
qwasmoffscreensurface.cpp:31
QWasmOffscreenSurface::~QWasmOffscreenSurface
~QWasmOffscreenSurface() final
Definition
qwasmoffscreensurface.cpp:26
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtbase
src
plugins
platforms
wasm
qwasmoffscreensurface.cpp
Generated on
for Qt by
1.18.0