1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-08 14:00:05 +00:00

Minor fixes for WICTextureLoader

This commit is contained in:
Chuck Walbourn 2016-12-08 14:26:41 -08:00
parent 0abee99a11
commit 101c306eaf
2 changed files with 9 additions and 7 deletions

View File

@ -353,12 +353,12 @@ namespace
if (width > height)
{
twidth = static_cast<UINT>(maxsize);
theight = static_cast<UINT>(static_cast<float>(maxsize) * ar);
theight = std::max<UINT>(1, static_cast<UINT>(static_cast<float>(maxsize) * ar));
}
else
{
theight = static_cast<UINT>(maxsize);
twidth = static_cast<UINT>(static_cast<float>(maxsize) / ar);
twidth = std::max<UINT>(1, static_cast<UINT>(static_cast<float>(maxsize) / ar));
}
assert(twidth <= maxsize && theight <= maxsize);
}
@ -389,12 +389,14 @@ namespace
{
memcpy(&convertGUID, &GUID_WICPixelFormat96bppRGBFloat, sizeof(WICPixelFormatGUID));
format = DXGI_FORMAT_R32G32B32_FLOAT;
bpp = 96;
}
else
#endif
{
memcpy(&convertGUID, &GUID_WICPixelFormat128bppRGBAFloat, sizeof(WICPixelFormatGUID));
format = DXGI_FORMAT_R32G32B32A32_FLOAT;
bpp = 128;
}
}
else
@ -472,7 +474,7 @@ namespace
sRGB = true;
}
PropVariantClear(&value);
(void)PropVariantClear(&value);
if (sRGB)
format = MakeSRGB(format);

View File

@ -296,12 +296,12 @@ namespace
if (width > height)
{
twidth = static_cast<UINT>(maxsize);
theight = static_cast<UINT>(static_cast<float>(maxsize) * ar);
theight = std::max<UINT>(1, static_cast<UINT>(static_cast<float>(maxsize) * ar));
}
else
{
theight = static_cast<UINT>(maxsize);
twidth = static_cast<UINT>(static_cast<float>(maxsize) / ar);
twidth = std::max<UINT>(1, static_cast<UINT>(static_cast<float>(maxsize) / ar));
}
assert(twidth <= maxsize && theight <= maxsize);
}
@ -381,7 +381,7 @@ namespace
sRGB = true;
}
PropVariantClear(&value);
(void)PropVariantClear(&value);
if (sRGB)
format = MakeSRGB(format);
@ -487,7 +487,7 @@ namespace
}
// Count the number of mips
uint32_t mipCount = (loadFlags & (WIC_LOADER_MIP_AUTOGEN | WIC_LOADER_MIP_RESERVE)) ? CountMips(twidth, theight) : 1;
uint32_t mipCount = (loadFlags & (WIC_LOADER_MIP_AUTOGEN|WIC_LOADER_MIP_RESERVE)) ? CountMips(twidth, theight) : 1;
// Create texture
D3D12_RESOURCE_DESC desc = {};