From 5b7fa5be7e9a91da992087f1be475290d2d3efe1 Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Tue, 11 Jul 2023 07:46:35 -0700 Subject: [PATCH] Remove redundant `Renderer::screenshot` definition --- src/core/renderer_gl/renderer_gl.cpp | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/core/renderer_gl/renderer_gl.cpp b/src/core/renderer_gl/renderer_gl.cpp index 3a587046..08a7632c 100644 --- a/src/core/renderer_gl/renderer_gl.cpp +++ b/src/core/renderer_gl/renderer_gl.cpp @@ -1064,31 +1064,5 @@ void RendererGL::screenshot(const std::string& name) { } } - stbi_write_png(name.c_str(), width, height, 4, flippedPixels.data(), 0); -} - -void Renderer::screenshot(const std::string& name) { - constexpr uint width = 400; - constexpr uint height = 2 * 240; - - std::vector pixels, flippedPixels; - pixels.resize(width * height * 4); - flippedPixels.resize(pixels.size()); - ; - - OpenGL::bindScreenFramebuffer(); - glReadPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE, pixels.data()); - - // Flip the image vertically - for (int y = 0; y < height; y++) { - memcpy(&flippedPixels[y * width * 4], &pixels[(height - y - 1) * width * 4], width * 4); - // Swap R and B channels - for (int x = 0; x < width; x++) { - std::swap(flippedPixels[y * width * 4 + x * 4 + 0], flippedPixels[y * width * 4 + x * 4 + 2]); - // Set alpha to 0xFF - flippedPixels[y * width * 4 + x * 4 + 3] = 0xFF; - } - } - stbi_write_png(name.c_str(), width, height, 4, flippedPixels.data(), 0); } \ No newline at end of file