From f9f955e2f373b7e701ad8f09bca04d10d5168129 Mon Sep 17 00:00:00 2001 From: aemony Date: Fri, 19 Jul 2024 23:16:59 +0200 Subject: [PATCH] Fixed gamma when capturing on Win8.1 --- include/utility/image.h | 7 ++++--- src/utility/image.cpp | 9 +-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/utility/image.h b/include/utility/image.h index 7637aff..43583aa 100644 --- a/include/utility/image.h +++ b/include/utility/image.h @@ -155,13 +155,14 @@ struct skiv_image_desktop_s { // Non-sRGB DXGI formats still use sRGB gamma so they need a hack to appear properly if (texDesc.Format == DXGI_FORMAT_R8G8B8A8_UNORM || - texDesc.Format == DXGI_FORMAT_B8G8R8X8_UNORM) + texDesc.Format == DXGI_FORMAT_B8G8R8X8_UNORM || + texDesc.Format == DXGI_FORMAT_B8G8R8A8_UNORM) _srgb_hack = true; // HDR formats indicates we are working with a HDR capture else if (texDesc.Format == DXGI_FORMAT_R10G10B10A2_UNORM || - texDesc.Format == DXGI_FORMAT_R16G16B16A16_FLOAT || - texDesc.Format == DXGI_FORMAT_R32G32B32A32_FLOAT) + texDesc.Format == DXGI_FORMAT_R16G16B16A16_FLOAT || + texDesc.Format == DXGI_FORMAT_R32G32B32A32_FLOAT) _hdr_image = true; #ifdef _DEBUG diff --git a/src/utility/image.cpp b/src/utility/image.cpp index 7696548..2032383 100644 --- a/src/utility/image.cpp +++ b/src/utility/image.cpp @@ -1407,7 +1407,7 @@ SKIV_Image_CaptureDesktop (DirectX::ScratchImage& image, POINT point, int flags) // The list of supported formats should always contain DXGI_FORMAT_B8G8R8A8_UNORM, // as this is the most common format for the desktop. - //DXGI_FORMAT_B8G8R8A8_UNORM + DXGI_FORMAT_B8G8R8A8_UNORM }; CComPtr pDuplicator; @@ -1498,13 +1498,6 @@ SKIV_Image_CaptureDesktop (DirectX::ScratchImage& image, POINT point, int flags) if (pDevCtx == nullptr) return E_UNEXPECTED; - // DXGI_FORMAT_B8G8R8A8_UNORM (Windows 8.1 fallback code) - // TODO: Blip from BGR -> RGB - if (surfDesc.Format == DXGI_FORMAT_B8G8R8A8_UNORM) // ! pOutput5 - { - PLOG_WARNING << "Windows 8.1 always captures in a BGR format, which this app currently does not support properly."; - } - #if 0 if (FAILED (pDevice->CreateTexture2D (&texDesc, nullptr, &pStagingTex.p))) {