From bdad044de473da52a3d526a004c2e713ddf626ce Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Mon, 1 Jun 2020 18:56:16 -0700 Subject: [PATCH] Added WIC_LOADER_SRGB_DEFAULT flag to WICTextureLoader --- Inc/WICTextureLoader.h | 3 ++- Src/WICTextureLoader.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Inc/WICTextureLoader.h b/Inc/WICTextureLoader.h index 703a2549e..3ba30045f 100644 --- a/Inc/WICTextureLoader.h +++ b/Inc/WICTextureLoader.h @@ -41,9 +41,10 @@ namespace DirectX WIC_LOADER_DEFAULT = 0, WIC_LOADER_FORCE_SRGB = 0x1, WIC_LOADER_IGNORE_SRGB = 0x2, - WIC_LOADER_FORCE_RGBA32 = 0x10, + WIC_LOADER_SRGB_DEFAULT = 0x4, WIC_LOADER_FIT_POW2 = 0x20, WIC_LOADER_MAKE_SQUARE = 0x40, + WIC_LOADER_FORCE_RGBA32 = 0x80, }; // Standard version diff --git a/Src/WICTextureLoader.cpp b/Src/WICTextureLoader.cpp index e388a82a6..3b9340783 100644 --- a/Src/WICTextureLoader.cpp +++ b/Src/WICTextureLoader.cpp @@ -467,6 +467,10 @@ namespace { sRGB = (value.uintVal == 45455); } + else + { + sRGB = (loadFlags & WIC_LOADER_SRGB_DEFAULT) != 0; + } } #if defined(_XBOX_ONE) && defined(_TITLE) else if (memcmp(&containerFormat, &GUID_ContainerFormatJpeg, sizeof(GUID)) == 0) @@ -475,6 +479,10 @@ namespace { sRGB = (value.uiVal == 1); } + else + { + sRGB = (loadFlags & WIC_LOADER_SRGB_DEFAULT) != 0; + } } else if (memcmp(&containerFormat, &GUID_ContainerFormatTiff, sizeof(GUID)) == 0) { @@ -482,12 +490,20 @@ namespace { sRGB = (value.uiVal == 1); } + else + { + sRGB = (loadFlags & WIC_LOADER_SRGB_DEFAULT) != 0; + } } #else else if (SUCCEEDED(metareader->GetMetadataByName(L"System.Image.ColorSpace", &value)) && value.vt == VT_UI2) { sRGB = (value.uiVal == 1); } + else + { + sRGB = (loadFlags & WIC_LOADER_SRGB_DEFAULT) != 0; + } #endif (void)PropVariantClear(&value);