diff --git a/sources/PPU/PPUUtils.hpp b/sources/PPU/PPUUtils.hpp index cb88312..916e403 100644 --- a/sources/PPU/PPUUtils.hpp +++ b/sources/PPU/PPUUtils.hpp @@ -51,12 +51,11 @@ namespace ComSquare::PPU::Utils template void merge2DArray(std::array, DEST_SIZE_Y> &bufferDest, const std::array, SRC_SIZE_Y> &bufferSrc, - const Vector2 &offset = {0, 0}) + const Vector2 &offset) { - for (unsigned long i = 0; i < bufferSrc.size(); i++) { - for (unsigned long j = 0; j < bufferSrc[i].size(); j++) { - bufferDest[i + offset.y][j + offset.x] = bufferSrc[i][j]; - } + int offsetY = offset.y; + for (auto &row : bufferSrc) { + std::copy(row.begin(), row.end(), bufferDest[offsetY++].begin() + offset.x); } }