From 987cc11afeea466e522af370051f5ad64c18553f Mon Sep 17 00:00:00 2001 From: JonBooth78 Date: Mon, 8 Jan 2024 21:05:06 +1300 Subject: [PATCH] Tidy up the screenshot functionality by making the write_png function hidden. --- src/PngWriter.cpp | 3 ++- src/PngWriter.h | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/PngWriter.cpp b/src/PngWriter.cpp index d457ea16835..76e1c098fe3 100644 --- a/src/PngWriter.cpp +++ b/src/PngWriter.cpp @@ -8,6 +8,7 @@ #include +namespace { void write_png(FileSystem::FileSourceFS &fs, const std::string &path, const Uint8 *bytes, int width, int height, int stride, int bytes_per_pixel, bool strip_alpha) { // Set up the pixel format color masks for RGB(A) byte arrays. @@ -39,7 +40,6 @@ void write_png(FileSystem::FileSourceFS &fs, const std::string &path, const Uint } // create a surface - //SDL_Surface *surface = SDL_CreateRGBSurfaceFrom((void*)bytes, width, height, bytes_per_pixel * 8, width * bytes_per_pixel, rmask, gmask, bmask, amask); SDL_Surface *surface = SDL_CreateRGBSurface(0, width, height, dest_bpp * 8, rmask, gmask, bmask, amask); // flip the image vertically and copy to destination surface @@ -85,6 +85,7 @@ void write_png(FileSystem::FileSourceFS &fs, const std::string &path, const Uint SDL_FreeSurface(surface); surface = nullptr; } +} //namespace void write_screenshot(const Graphics::ScreendumpState &sd, const char *destFile) { diff --git a/src/PngWriter.h b/src/PngWriter.h index 5c6e35724f9..8aed120ce4b 100644 --- a/src/PngWriter.h +++ b/src/PngWriter.h @@ -7,17 +7,10 @@ #include #include -namespace FileSystem { - class FileSourceFS; -} - namespace Graphics { struct ScreendumpState; } -// stride is in bytes (bytes per row) -void write_png(FileSystem::FileSourceFS &fs, const std::string &path, const Uint8 *bytes, int width, int height, int stride, int bytes_per_pixel, bool strip_alpha = false); - void write_screenshot(const Graphics::ScreendumpState &sd, const char *destFile); #endif