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
5
7
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(),
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
26{
27 emscripten::val::module_property("specialHTMLTargets").delete_(m_specialTargetId);
28}
29
31{
32 return !m_offscreenCanvas.isNull() && !m_offscreenCanvas.isUndefined();
33}
34
\inmodule QtGui
QSize size() const override
Returns the size of the offscreen surface.
QOffscreenSurface * offscreenSurface() const
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:130
bool isValid() const override
Returns true if the platform offscreen surface has been allocated.
QWasmOffscreenSurface(QOffscreenSurface *offscreenSurface)
Combined button and popup list for selecting options.
GLuint GLfloat * val