Added WIC_LOADER_SRGB_DEFAULT flag to WICTextureLoader

This commit is contained in:
Chuck Walbourn 2020-06-01 19:00:09 -07:00
parent 17aeb40917
commit 2873a800d0
6 changed files with 27 additions and 9 deletions

View File

@ -39,9 +39,9 @@ namespace DirectX
enum DDS_LOADER_FLAGS
{
DDS_LOADER_DEFAULT = 0,
DDS_LOADER_FORCE_SRGB = 0x1,
DDS_LOADER_MIP_RESERVE = 0x8,
DDS_LOADER_DEFAULT = 0,
DDS_LOADER_FORCE_SRGB = 0x1,
DDS_LOADER_MIP_RESERVE = 0x8,
};
// Standard version

View File

@ -534,11 +534,19 @@ namespace
{
sRGB = (value.uintVal == 45455);
}
else
{
sRGB = (loadFlags & WIC_LOADER_SRGB_DEFAULT) != 0;
}
}
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;
}
(void)PropVariantClear(&value);

View File

@ -36,9 +36,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,
};
#endif

View File

@ -445,11 +445,19 @@ namespace
{
sRGB = (value.uintVal == 45455);
}
else
{
sRGB = (loadFlags & WIC_LOADER_SRGB_DEFAULT) != 0;
}
}
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;
}
(void)PropVariantClear(&value);

View File

@ -35,11 +35,12 @@ namespace DirectX
WIC_LOADER_DEFAULT = 0,
WIC_LOADER_FORCE_SRGB = 0x1,
WIC_LOADER_IGNORE_SRGB = 0x2,
WIC_LOADER_MIP_AUTOGEN = 0x4,
WIC_LOADER_MIP_RESERVE = 0x8,
WIC_LOADER_FORCE_RGBA32 = 0x10,
WIC_LOADER_SRGB_DEFAULT = 0x4,
WIC_LOADER_MIP_AUTOGEN = 0x8,
WIC_LOADER_MIP_RESERVE = 0x10,
WIC_LOADER_FIT_POW2 = 0x20,
WIC_LOADER_MAKE_SQUARE = 0x40,
WIC_LOADER_FORCE_RGBA32 = 0x80,
};
#endif

View File

@ -33,10 +33,10 @@ namespace DirectX
enum WIC_LOADER_FLAGS : uint32_t
{
WIC_LOADER_DEFAULT = 0,
WIC_LOADER_MIP_AUTOGEN = 0x4,
WIC_LOADER_FORCE_RGBA32 = 0x10,
WIC_LOADER_MIP_AUTOGEN = 0x8,
WIC_LOADER_FIT_POW2 = 0x20,
WIC_LOADER_MAKE_SQUARE = 0x40,
WIC_LOADER_FORCE_RGBA32 = 0x80,
};
#endif