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>
This commit is contained in:
parent
b8f40af176
commit
ecd7ddcc3e
@ -87,7 +87,8 @@ void QWasmBackingStore::updateTexture(QWasmWindow *window)
|
|||||||
auto imageMemory = emscripten::typed_memory_view(dirtyRect.width() * dirtyRect.height()
|
auto imageMemory = emscripten::typed_memory_view(dirtyRect.width() * dirtyRect.height()
|
||||||
* BytesPerColor,
|
* BytesPerColor,
|
||||||
m_image.constScanLine(dirtyRect.y()));
|
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 {
|
} else {
|
||||||
// Go through the scanlines manually to set the individual lines in bulk. This is
|
// Go through the scanlines manually to set the individual lines in bulk. This is
|
||||||
// marginally less performant than the above.
|
// marginally less performant than the above.
|
||||||
@ -98,11 +99,12 @@ void QWasmBackingStore::updateTexture(QWasmWindow *window)
|
|||||||
// ...............
|
// ...............
|
||||||
for (int r = 0; r < dirtyRect.height(); ++r) {
|
for (int r = 0; r < dirtyRect.height(); ++r) {
|
||||||
auto scanlineMemory = emscripten::typed_memory_view(
|
auto scanlineMemory = emscripten::typed_memory_view(
|
||||||
dirtyRect.width() * 4,
|
dirtyRect.width() * BytesPerColor,
|
||||||
m_image.constScanLine(r) + BytesPerColor * dirtyRect.x());
|
m_image.constScanLine(r + dirtyRect.y()) + BytesPerColor * dirtyRect.x());
|
||||||
m_webImageDataArray["data"].call<void>("set", scanlineMemory,
|
m_webImageDataArray["data"].call<void>("set", scanlineMemory,
|
||||||
(r * dirtyRect.width() + dirtyRect.x())
|
(dirtyRect.y() + r) * m_image.width()
|
||||||
* BytesPerColor);
|
* BytesPerColor
|
||||||
|
+ dirtyRect.x() * BytesPerColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user