diff options
| author | Mikolaj Boc <mikolaj.boc@qt.io> | 2023-03-29 15:31:23 +0200 |
|---|---|---|
| committer | Mikolaj Boc <mikolaj.boc@qt.io> | 2023-03-31 17:42:58 +0200 |
| commit | ecd7ddcc3e7ccf7750190b4aedd3ad683dd4f97d (patch) | |
| tree | 78077a06bf37db1a594d1bf49f116762a7c8f8d2 /src/plugins/platforms/wasm/qwasmbackingstore.cpp | |
| parent | b8f40af17680917a9542acaf967a6c486f8ba71c (diff) | |
Correctly update the texture in qwasmbackingstore
Both the full-width and partial-width paths in
QWasmBackingStore::updateTexture now correctly compute source and
target rects.
Task-number: QTBUG-112414
Change-Id: I30b0952609960f521119d3d628d2a8036f8b1fe5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmbackingstore.cpp')
| -rw-r--r-- | src/plugins/platforms/wasm/qwasmbackingstore.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/platforms/wasm/qwasmbackingstore.cpp b/src/plugins/platforms/wasm/qwasmbackingstore.cpp index e9625928620..f6d219dbde8 100644 --- a/src/plugins/platforms/wasm/qwasmbackingstore.cpp +++ b/src/plugins/platforms/wasm/qwasmbackingstore.cpp @@ -87,7 +87,8 @@ void QWasmBackingStore::updateTexture(QWasmWindow *window) auto imageMemory = emscripten::typed_memory_view(dirtyRect.width() * dirtyRect.height() * BytesPerColor, m_image.constScanLine(dirtyRect.y())); - m_webImageDataArray["data"].call<void>("set", imageMemory); + m_webImageDataArray["data"].call<void>("set", imageMemory, + dirtyRect.y() * m_image.width() * BytesPerColor); } else { // Go through the scanlines manually to set the individual lines in bulk. This is // marginally less performant than the above. @@ -98,11 +99,12 @@ void QWasmBackingStore::updateTexture(QWasmWindow *window) // ............... for (int r = 0; r < dirtyRect.height(); ++r) { auto scanlineMemory = emscripten::typed_memory_view( - dirtyRect.width() * 4, - m_image.constScanLine(r) + BytesPerColor * dirtyRect.x()); + dirtyRect.width() * BytesPerColor, + m_image.constScanLine(r + dirtyRect.y()) + BytesPerColor * dirtyRect.x()); m_webImageDataArray["data"].call<void>("set", scanlineMemory, - (r * dirtyRect.width() + dirtyRect.x()) - * BytesPerColor); + (dirtyRect.y() + r) * m_image.width() + * BytesPerColor + + dirtyRect.x() * BytesPerColor); } } } |
