fix: screenshot taken was black

This commit is contained in:
Alexis Maiquez 2024-10-12 20:25:56 +02:00
parent 7278f2f817
commit c400f49275

View File

@ -237,12 +237,12 @@ void CWallpaperApplication::takeScreenshot (const std::filesystem::path& filenam
// now get access to the pixels // now get access to the pixels
for (int y = viewport->viewport.w; y > 0; y--) { for (int y = viewport->viewport.w; y > 0; y--) {
for (int x = 0; x < viewport->viewport.z; x++) { for (int x = 0; x < viewport->viewport.z; x++) {
int finalx = x + xoffset; int xfinal = x + xoffset;
int finaly = this->m_renderContext->getOutput ().renderVFlip () ? (viewport->viewport.w - y) : y; int yfinal = this->m_renderContext->getOutput ().renderVFlip () ? (viewport->viewport.w - y) : y;
bitmap[finaly * 3 + finalx] = *pixel++; bitmap[yfinal * width * 3 + xfinal * 3] = *pixel++;
bitmap[finaly * 3 + finalx + 1] = *pixel++; bitmap[yfinal * width * 3 + xfinal * 3 + 1] = *pixel++;
bitmap[finaly * 3 + finalx + 2] = *pixel++; bitmap[yfinal * width * 3 + xfinal * 3 + 2] = *pixel++;
} }
} }