mirror of
https://github.com/microsoft/DirectXTex.git
synced 2026-02-07 05:26:12 +01:00
Constify variables in standalone modules
This commit is contained in:
@@ -296,7 +296,7 @@ namespace
|
||||
//---------------------------------------------------------------------------------
|
||||
void FitPowerOf2(UINT origx, UINT origy, UINT& targetx, UINT& targety, size_t maxsize)
|
||||
{
|
||||
float origAR = float(origx) / float(origy);
|
||||
const float origAR = float(origx) / float(origy);
|
||||
|
||||
if (origx > origy)
|
||||
{
|
||||
@@ -307,7 +307,7 @@ namespace
|
||||
float bestScore = FLT_MAX;
|
||||
for (size_t y = maxsize; y > 0; y >>= 1)
|
||||
{
|
||||
float score = fabsf((float(x) / float(y)) - origAR);
|
||||
const float score = fabsf((float(x) / float(y)) - origAR);
|
||||
if (score < bestScore)
|
||||
{
|
||||
bestScore = score;
|
||||
@@ -324,7 +324,7 @@ namespace
|
||||
float bestScore = FLT_MAX;
|
||||
for (size_t x = maxsize; x > 0; x >>= 1)
|
||||
{
|
||||
float score = fabsf((float(x) / float(y)) - origAR);
|
||||
const float score = fabsf((float(x) / float(y)) - origAR);
|
||||
if (score < bestScore)
|
||||
{
|
||||
bestScore = score;
|
||||
@@ -367,7 +367,7 @@ namespace
|
||||
}
|
||||
else if (width > maxsize || height > maxsize)
|
||||
{
|
||||
float ar = static_cast<float>(height) / static_cast<float>(width);
|
||||
const float ar = static_cast<float>(height) / static_cast<float>(width);
|
||||
if (width > height)
|
||||
{
|
||||
twidth = static_cast<UINT>(maxsize);
|
||||
@@ -484,14 +484,14 @@ namespace
|
||||
}
|
||||
|
||||
// Allocate memory for decoded image
|
||||
uint64_t rowBytes = (uint64_t(twidth) * uint64_t(bpp) + 7u) / 8u;
|
||||
uint64_t numBytes = rowBytes * uint64_t(theight);
|
||||
const uint64_t rowBytes = (uint64_t(twidth) * uint64_t(bpp) + 7u) / 8u;
|
||||
const uint64_t numBytes = rowBytes * uint64_t(theight);
|
||||
|
||||
if (rowBytes > UINT32_MAX || numBytes > UINT32_MAX)
|
||||
return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
|
||||
|
||||
auto rowPitch = static_cast<size_t>(rowBytes);
|
||||
auto imageSize = static_cast<size_t>(numBytes);
|
||||
auto const rowPitch = static_cast<size_t>(rowBytes);
|
||||
auto const imageSize = static_cast<size_t>(numBytes);
|
||||
|
||||
decodedData.reset(new (std::nothrow) uint8_t[imageSize]);
|
||||
if (!decodedData)
|
||||
@@ -587,7 +587,7 @@ namespace
|
||||
}
|
||||
|
||||
// Count the number of mips
|
||||
uint32_t mipCount = (loadFlags & (WIC_LOADER_MIP_AUTOGEN | WIC_LOADER_MIP_RESERVE))
|
||||
const uint32_t mipCount = (loadFlags & (WIC_LOADER_MIP_AUTOGEN | WIC_LOADER_MIP_RESERVE))
|
||||
? CountMips(twidth, theight) : 1u;
|
||||
|
||||
// Create texture
|
||||
@@ -602,7 +602,7 @@ namespace
|
||||
desc.Flags = resFlags;
|
||||
desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
|
||||
|
||||
CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT);
|
||||
const CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT);
|
||||
|
||||
ID3D12Resource* tex = nullptr;
|
||||
hr = d3dDevice->CreateCommittedResource(
|
||||
|
||||
Reference in New Issue
Block a user