From 111e3b8663b114a45baf750dcb8eb8fa674c964c Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Tue, 17 Jan 2023 13:28:28 +1000 Subject: wasm: remove canvas size code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes redundant code that gets canvas size to update the video element and offscreencanvas. We now get this from the video itself. Pick-to: 6.5 Change-Id: I4063385316faad24aa0e5880d5e1c6abf94efabd Reviewed-by: MikoĊ‚aj Boc --- .../multimedia/wasm/common/qwasmvideooutput.cpp | 24 +--------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/plugins/multimedia/wasm/common/qwasmvideooutput.cpp b/src/plugins/multimedia/wasm/common/qwasmvideooutput.cpp index 2c84824cc..041d10254 100644 --- a/src/plugins/multimedia/wasm/common/qwasmvideooutput.cpp +++ b/src/plugins/multimedia/wasm/common/qwasmvideooutput.cpp @@ -661,29 +661,7 @@ void QWasmVideoOutput::doElementCallbacks() void QWasmVideoOutput::updateVideoElementGeometry(const QRect &windowGeometry) { - qCDebug(qWasmMediaVideoOutput) << Q_FUNC_INFO; - - // if (m_videoElementSource.isUndefined() || m_videoElementSource.isNull()) - // return; - // Resolve the geometry against Qt canvas geometry, in case the canvas - // is offset (not at (0,0)) relative to the body element. The id for the - // canvas is set in the .html file, in this case "qtcanvas" when using the - // default generated html. - - emscripten::val document = emscripten::val::global("document"); - - emscripten::val canvas = - document.call("getElementById", std::string("qtcanvas")); - - emscripten::val contextAttributes = emscripten::val::array(); - contextAttributes.set("preserveDrawingBuffer", true); - - if (canvas.isUndefined()) - qFatal("Could not find canvas element"); - - emscripten::val rect = canvas.call("getBoundingClientRect"); - QPoint canvasPosition(rect["left"].as(), rect["top"].as()); - QRect m_videoElementSource(windowGeometry.topLeft() + canvasPosition, windowGeometry.size()); + QRect m_videoElementSource(windowGeometry.topLeft(), windowGeometry.size()); emscripten::val style = m_video["style"]; style.set("left", QString("%1px").arg(m_videoElementSource.left()).toStdString()); -- cgit v1.2.3