Skip to content

Commit

Permalink
fix: screenshot taken was black
Browse files Browse the repository at this point in the history
  • Loading branch information
Almamu committed Oct 12, 2024
1 parent 7278f2f commit c400f49
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/WallpaperEngine/Application/CWallpaperApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ void CWallpaperApplication::takeScreenshot (const std::filesystem::path& filenam
// now get access to the pixels
for (int y = viewport->viewport.w; y > 0; y--) {
for (int x = 0; x < viewport->viewport.z; x++) {
int finalx = x + xoffset;
int finaly = this->m_renderContext->getOutput ().renderVFlip () ? (viewport->viewport.w - y) : y;
int xfinal = x + xoffset;
int yfinal = this->m_renderContext->getOutput ().renderVFlip () ? (viewport->viewport.w - y) : y;

bitmap[finaly * 3 + finalx] = *pixel++;
bitmap[finaly * 3 + finalx + 1] = *pixel++;
bitmap[finaly * 3 + finalx + 2] = *pixel++;
bitmap[yfinal * width * 3 + xfinal * 3] = *pixel++;
bitmap[yfinal * width * 3 + xfinal * 3 + 1] = *pixel++;
bitmap[yfinal * width * 3 + xfinal * 3 + 2] = *pixel++;
}
}

Expand Down

0 comments on commit c400f49

Please sign in to comment.