diff --git a/src/renderer/atlas/BackendD3D.cpp b/src/renderer/atlas/BackendD3D.cpp index a9e81422d0a..33cb3147355 100644 --- a/src/renderer/atlas/BackendD3D.cpp +++ b/src/renderer/atlas/BackendD3D.cpp @@ -1069,12 +1069,13 @@ void BackendD3D::_uploadBackgroundBitmap(const RenderingPayload& p) auto src = std::bit_cast(p.backgroundBitmap.data()); const auto srcEnd = std::bit_cast(p.backgroundBitmap.data() + p.backgroundBitmap.size()); + const auto srcWidth = p.s->viewportCellCount.x * sizeof(u32); const auto srcStride = p.colorBitmapRowStride * sizeof(u32); auto dst = static_cast(mapped.pData); while (src < srcEnd) { - memcpy(dst, src, srcStride); + memcpy(dst, src, srcWidth); src += srcStride; dst += mapped.RowPitch; }