From a66d08d7da49252a7c8e6534317dd2a1eb9692f1 Mon Sep 17 00:00:00 2001 From: aemony Date: Wed, 26 Jun 2024 04:55:02 +0200 Subject: [PATCH] Detect if SKIV is using HDR or not when snipping --- src/SKIV.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/SKIV.cpp b/src/SKIV.cpp index 1378bf1..ca77c50 100644 --- a/src/SKIV.cpp +++ b/src/SKIV.cpp @@ -1780,6 +1780,8 @@ wWinMain ( _In_ HINSTANCE hInstance, ImVec2 vDesktopSize (0.0f, 0.0f); + bool SKIV_HDR = (_registry.iHDRMode > 0 && SKIF_Util_IsHDRActive ( )); + extern CComPtr SKIV_DesktopImage; CComPtr pDesktopRes; @@ -1801,8 +1803,13 @@ wWinMain ( _In_ HINSTANCE hInstance, } } - SKIF_ImGui_OptImage (SKIV_DesktopImage, vDesktopSize, ImVec2 (-1024.0f, -1024.0f), - ImVec2 (-2048.0f, -2048.0f)); + static const ImVec2 sdr_uv0 = ImVec2 (0, 0), + sdr_uv1 = ImVec2 (1, 1), + hdr_uv0 = ImVec2 (-1024.0f, -1024.0f), + hdr_uv1 = ImVec2 (-2048.0f, -2048.0f); + + SKIF_ImGui_OptImage (SKIV_DesktopImage, vDesktopSize, (SKIV_HDR) ? hdr_uv0 : sdr_uv0, + (SKIV_HDR) ? hdr_uv1 : sdr_uv1); extern uint32_t SKIV_HDR_VisualizationId; extern float SKIV_HDR_SDRWhite; @@ -2085,7 +2092,7 @@ wWinMain ( _In_ HINSTANCE hInstance, extern bool SKIV_Image_CopyToClipboard (const DirectX::Image* pImage, bool snipped, bool isHDR); - if (SKIV_Image_CopyToClipboard (subrect.GetImages (), true, (_registry.iHDRMode > 0 && SKIF_Util_IsHDRActive ( )))) + if (SKIV_Image_CopyToClipboard (subrect.GetImages (), true, SKIV_HDR)) PLOG_VERBOSE << "SKIV_Image_CopyToClipboard ( ): SUCCEEDED"; else PLOG_WARNING << "SKIV_Image_CopyToClipboard ( ): FAILED";