diff --git a/sources/PPU/PPUUtils.hpp b/sources/PPU/PPUUtils.hpp index 916e403..c1799f1 100644 --- a/sources/PPU/PPUUtils.hpp +++ b/sources/PPU/PPUUtils.hpp @@ -82,12 +82,23 @@ namespace ComSquare::PPU::Utils static void addBuffer(std::array, DEST_SIZE_X> &bufferDest, const std::array, SRC_SIZE_X> &bufferSrc) { - for (unsigned long i = 0; i < bufferSrc.size(); i++) { + int i = 0; + int j = 0; + std::for_each(bufferSrc.begin(), bufferSrc.end(), [&bufferDest, &i, &j](auto &sourceRow) { + i++; + std::for_each(sourceRow.begin(), sourceRow.end(), [&bufferDest, &i, &j](auto &pixel) { + if (pixel > 0xFF) + bufferDest[i][j] = pixel; + j++; + }); + j = 0; + }); + /* for (unsigned long i = 0; i < bufferSrc.size(); i++) { for (unsigned long j = 0; j < bufferSrc[i].size(); j++) { if (bufferSrc[i][j] > 0xFF) // 0xFF correspond to a black pixel with full brightness bufferDest[i][j] = bufferSrc[i][j]; } - } + }*/ } }