From 686a79685eab45a17b50332979f88be127b9b303 Mon Sep 17 00:00:00 2001 From: Aleksey Komarov Date: Sun, 22 May 2022 23:09:58 +0300 Subject: [PATCH] [linux] add #ifdef _WIN32 // Screenshot --- src/libs/renderer/src/s_device.cpp | 6 ++++++ src/libs/renderer/src/s_device.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/libs/renderer/src/s_device.cpp b/src/libs/renderer/src/s_device.cpp index 24b831fd9..3b79b74f0 100644 --- a/src/libs/renderer/src/s_device.cpp +++ b/src/libs/renderer/src/s_device.cpp @@ -38,6 +38,7 @@ namespace { constexpr auto kKeyTakeScreenshot = "TakeScreenshot"; +#ifdef _WIN32 // Screenshot D3DXIMAGE_FILEFORMAT GetScreenshotFormat(const std::string &fmt) { if (fmt == "bmp") @@ -79,6 +80,7 @@ D3DXIMAGE_FILEFORMAT GetScreenshotFormat(const std::string &fmt) return D3DXIFF_FORCE_DWORD; } +#endif void InvokeEntitiesLostRender() { @@ -494,12 +496,14 @@ bool DX9RENDER::Init() screenshotExt = str; std::ranges::transform(screenshotExt, screenshotExt.begin(), [](const unsigned char c) { return std::tolower(c); }); +#ifdef _WIN32 // Screenshot screenshotFormat = GetScreenshotFormat(str); if (screenshotFormat == D3DXIFF_FORCE_DWORD) { screenshotExt = "jpg"; screenshotFormat = D3DXIFF_JPG; } +#endif bShowFps = ini->GetInt(nullptr, "show_fps", 0) == 1; bShowExInfo = ini->GetInt(nullptr, "show_exinfo", 0) == 1; @@ -3282,7 +3286,9 @@ void DX9RENDER::MakeScreenShot() screenshot_path.replace_filename(screenshot_base_filename + "_" + std::to_string(i)); screenshot_path.replace_extension(screenshotExt); } +#ifdef _WIN32 // Screenshot D3DXSaveSurfaceToFile(screenshot_path.c_str(), screenshotFormat, surface, nullptr, nullptr); +#endif surface->Release(); renderTarget->Release(); diff --git a/src/libs/renderer/src/s_device.h b/src/libs/renderer/src/s_device.h index b1cd88d45..8c743c408 100644 --- a/src/libs/renderer/src/s_device.h +++ b/src/libs/renderer/src/s_device.h @@ -593,7 +593,9 @@ class DX9RENDER : public VDX9RENDER std::stack stRenderTarget; +#ifdef _WIN32 // Screenshot D3DXIMAGE_FILEFORMAT screenshotFormat; +#endif std::string screenshotExt; bool TextureLoad(int32_t texid);