1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 12:00:06 +00:00

Constify variables in standalone modules

This commit is contained in:
Chuck Walbourn 2022-02-21 02:21:35 -08:00
parent 174539feb3
commit 3599374502
9 changed files with 71 additions and 71 deletions

View File

@ -55,7 +55,7 @@ using namespace DirectX;
//--------------------------------------------------------------------------------------
#pragma pack(push,1)
const uint32_t DDS_MAGIC = 0x20534444; // "DDS "
constexpr uint32_t DDS_MAGIC = 0x20534444; // "DDS "
struct DDS_PIXELFORMAT
{
@ -172,7 +172,7 @@ namespace
}
// DDS files always start with the same magic number ("DDS ")
auto dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData);
auto const dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData);
if (dwMagicNumber != DDS_MAGIC)
{
return E_FAIL;
@ -296,7 +296,7 @@ namespace
}
// DDS files always start with the same magic number ("DDS ")
auto dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData.get());
auto const dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData.get());
if (dwMagicNumber != DDS_MAGIC)
{
ddsData.reset();
@ -602,7 +602,7 @@ namespace
}
else
{
size_t bpp = BitsPerPixel(fmt);
const size_t bpp = BitsPerPixel(fmt);
if (!bpp)
return E_INVALIDARG;
@ -1053,7 +1053,7 @@ namespace
_In_ unsigned int miscFlags,
_In_ bool forceSRGB,
_In_ bool isCubeMap,
_In_reads_opt_(mipCount*arraySize) D3D11_SUBRESOURCE_DATA* initData,
_In_reads_opt_(mipCount*arraySize) const D3D11_SUBRESOURCE_DATA* initData,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept
{
@ -1289,7 +1289,7 @@ namespace
{
HRESULT hr = S_OK;
UINT width = header->width;
const UINT width = header->width;
UINT height = header->height;
UINT depth = header->depth;
@ -1541,7 +1541,7 @@ namespace
return HRESULT_FROM_WIN32(ERROR_HANDLE_EOF);
}
UINT res = D3D11CalcSubresource(0, item, mipLevels);
const UINT res = D3D11CalcSubresource(0, item, mipLevels);
d3dContext->UpdateSubresource(tex, res, nullptr, pSrcBits, static_cast<UINT>(rowBytes), static_cast<UINT>(numBytes));
pSrcBits += numBytes;
}
@ -1652,7 +1652,7 @@ namespace
if (MAKEFOURCC('D', 'X', '1', '0') == header->ddspf.fourCC)
{
auto d3d10ext = reinterpret_cast<const DDS_HEADER_DXT10*>(reinterpret_cast<const uint8_t*>(header) + sizeof(DDS_HEADER));
auto mode = static_cast<DDS_ALPHA_MODE>(d3d10ext->miscFlags2 & DDS_MISC_FLAGS2_ALPHA_MODE_MASK);
auto const mode = static_cast<DDS_ALPHA_MODE>(d3d10ext->miscFlags2 & DDS_MISC_FLAGS2_ALPHA_MODE_MASK);
switch (mode)
{
case DDS_ALPHA_MODE_STRAIGHT:
@ -1686,7 +1686,7 @@ namespace
if (texture || textureView)
{
CHAR strFileA[MAX_PATH];
int result = WideCharToMultiByte(CP_UTF8,
const int result = WideCharToMultiByte(CP_UTF8,
WC_NO_BEST_FIT_CHARS,
fileName,
-1,

View File

@ -83,7 +83,7 @@ using namespace DirectX;
//--------------------------------------------------------------------------------------
#pragma pack(push,1)
const uint32_t DDS_MAGIC = 0x20534444; // "DDS "
constexpr uint32_t DDS_MAGIC = 0x20534444; // "DDS "
struct DDS_PIXELFORMAT
{
@ -218,7 +218,7 @@ namespace
}
// DDS files always start with the same magic number ("DDS ")
auto dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData);
auto const dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData);
if (dwMagicNumber != DDS_MAGIC)
{
return E_FAIL;
@ -371,7 +371,7 @@ namespace
#endif
// DDS files always start with the same magic number ("DDS ")
auto dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData.get());
auto const dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData.get());
if (dwMagicNumber != DDS_MAGIC)
{
ddsData.reset();
@ -681,7 +681,7 @@ namespace
}
else
{
size_t bpp = BitsPerPixel(fmt);
const size_t bpp = BitsPerPixel(fmt);
if (!bpp)
return E_INVALIDARG;
@ -1226,7 +1226,7 @@ namespace
desc.SampleDesc.Quality = 0;
desc.Dimension = resDim;
CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT);
const CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT);
hr = d3dDevice->CreateCommittedResource(
&defaultHeapProperties,
@ -1260,7 +1260,7 @@ namespace
{
HRESULT hr = S_OK;
UINT width = header->width;
const UINT width = header->width;
UINT height = header->height;
UINT depth = header->depth;
@ -1426,7 +1426,7 @@ namespace
return HRESULT_E_NOT_SUPPORTED;
}
UINT numberOfPlanes = D3D12GetFormatPlaneCount(d3dDevice, format);
const UINT numberOfPlanes = D3D12GetFormatPlaneCount(d3dDevice, format);
if (!numberOfPlanes)
return E_INVALIDARG;
@ -1510,7 +1510,7 @@ namespace
if ( MAKEFOURCC( 'D', 'X', '1', '0' ) == header->ddspf.fourCC )
{
auto d3d10ext = reinterpret_cast<const DDS_HEADER_DXT10*>(reinterpret_cast<const uint8_t*>(header) + sizeof(DDS_HEADER));
auto mode = static_cast<DDS_ALPHA_MODE>( d3d10ext->miscFlags2 & DDS_MISC_FLAGS2_ALPHA_MODE_MASK );
auto const mode = static_cast<DDS_ALPHA_MODE>( d3d10ext->miscFlags2 & DDS_MISC_FLAGS2_ALPHA_MODE_MASK );
switch( mode )
{
case DDS_ALPHA_MODE_STRAIGHT:

View File

@ -59,7 +59,7 @@ using Microsoft::WRL::ComPtr;
//--------------------------------------------------------------------------------------
#pragma pack(push,1)
const uint32_t DDS_MAGIC = 0x20534444; // "DDS "
constexpr uint32_t DDS_MAGIC = 0x20534444; // "DDS "
struct DDS_PIXELFORMAT
{
@ -150,7 +150,7 @@ namespace
}
// DDS files always start with the same magic number ("DDS ")
auto dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData);
auto const dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData);
if (dwMagicNumber != DDS_MAGIC)
{
return E_FAIL;
@ -266,7 +266,7 @@ namespace
}
// DDS files always start with the same magic number ("DDS ")
auto dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData.get());
auto const dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData.get());
if (dwMagicNumber != DDS_MAGIC)
{
ddsData.reset();
@ -474,7 +474,7 @@ namespace
}
else
{
size_t bpp = BitsPerPixel(fmt);
const size_t bpp = BitsPerPixel(fmt);
if (!bpp)
return E_INVALIDARG;
@ -800,7 +800,7 @@ namespace
// We could support a subset of 'DX10' extended header DDS files, but we'll assume here we are only
// supporting legacy DDS files for a Direct3D9 device
D3DFORMAT fmt = GetD3D9Format(header->ddspf);
const D3DFORMAT fmt = GetD3D9Format(header->ddspf);
if (fmt == D3DFMT_UNKNOWN || BitsPerPixel(fmt) == 0)
{
return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);

View File

@ -565,7 +565,7 @@ namespace
}
else
{
size_t bpp = BitsPerPixel(fmt);
const size_t bpp = BitsPerPixel(fmt);
if (!bpp)
return E_INVALIDARG;
@ -670,7 +670,7 @@ namespace
assert(pTemp);
DXGI_FORMAT fmt = EnsureNotTypeless(desc.Format);
const DXGI_FORMAT fmt = EnsureNotTypeless(desc.Format);
UINT support = 0;
hr = d3dDevice->CheckFormatSupport(fmt, &support);
@ -684,7 +684,7 @@ namespace
{
for (UINT level = 0; level < desc.MipLevels; ++level)
{
UINT index = D3D11CalcSubresource(level, item, desc.MipLevels);
const UINT index = D3D11CalcSubresource(level, item, desc.MipLevels);
pContext->ResolveSubresource(pTemp.Get(), index, pSource, index, fmt);
}
}
@ -816,7 +816,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
auto_delete_file delonfail(hFile.get());
// Setup header
const size_t MAX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_DXT10);
constexpr size_t MAX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_DXT10);
uint8_t fileHeader[MAX_HEADER_SIZE] = {};
*reinterpret_cast<uint32_t*>(&fileHeader[0]) = DDS_MAGIC;
@ -924,7 +924,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
uint8_t* dptr = pixels.get();
size_t msize = std::min<size_t>(rowPitch, mapped.RowPitch);
const size_t msize = std::min<size_t>(rowPitch, mapped.RowPitch);
for (size_t h = 0; h < rowCount; ++h)
{
memcpy_s(dptr, rowPitch, sptr, msize);
@ -1187,7 +1187,7 @@ HRESULT DirectX::SaveWICTextureToFile(
if (FAILED(hr))
return hr;
uint64_t imageSize = uint64_t(mapped.RowPitch) * uint64_t(desc.Height);
const uint64_t imageSize = uint64_t(mapped.RowPitch) * uint64_t(desc.Height);
if (imageSize > UINT32_MAX)
{
pContext->Unmap(pStaging.Get(), 0);

View File

@ -593,7 +593,7 @@ namespace
}
else
{
size_t bpp = BitsPerPixel(fmt);
const size_t bpp = BitsPerPixel(fmt);
if (!bpp)
return E_INVALIDARG;
@ -700,7 +700,7 @@ namespace
if (srcPitch > UINT32_MAX)
return HRESULT_E_ARITHMETIC_OVERFLOW;
UINT numberOfPlanes = D3D12GetFormatPlaneCount(device, desc.Format);
const UINT numberOfPlanes = D3D12GetFormatPlaneCount(device, desc.Format);
if (numberOfPlanes != 1)
return HRESULT_E_NOT_SUPPORTED;
@ -733,8 +733,8 @@ namespace
assert((srcPitch & 0xFF) == 0);
CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT);
CD3DX12_HEAP_PROPERTIES readBackHeapProperties(D3D12_HEAP_TYPE_READBACK);
const CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT);
const CD3DX12_HEAP_PROPERTIES readBackHeapProperties(D3D12_HEAP_TYPE_READBACK);
// Readback resources must be buffers
D3D12_RESOURCE_DESC bufferDesc = {};
@ -771,7 +771,7 @@ namespace
assert(pTemp);
DXGI_FORMAT fmt = EnsureNotTypeless(desc.Format);
const DXGI_FORMAT fmt = EnsureNotTypeless(desc.Format);
D3D12_FEATURE_DATA_FORMAT_SUPPORT formatInfo = { fmt, D3D12_FORMAT_SUPPORT1_NONE, D3D12_FORMAT_SUPPORT2_NONE };
hr = device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &formatInfo, sizeof(formatInfo));
@ -785,7 +785,7 @@ namespace
{
for (UINT level = 0; level < desc.MipLevels; ++level)
{
UINT index = D3D12CalcSubresource(level, item, 0, desc.MipLevels, desc.DepthOrArraySize);
const UINT index = D3D12CalcSubresource(level, item, 0, desc.MipLevels, desc.DepthOrArraySize);
commandList->ResolveSubresource(pTemp.Get(), index, pSource, index, fmt);
}
}
@ -818,8 +818,8 @@ namespace
bufferFootprint.Footprint.RowPitch = static_cast<UINT>(srcPitch);
bufferFootprint.Footprint.Format = desc.Format;
CD3DX12_TEXTURE_COPY_LOCATION copyDest(pStaging.Get(), bufferFootprint);
CD3DX12_TEXTURE_COPY_LOCATION copySrc(copySource.Get(), 0);
const CD3DX12_TEXTURE_COPY_LOCATION copyDest(pStaging.Get(), bufferFootprint);
const CD3DX12_TEXTURE_COPY_LOCATION copySrc(copySource.Get(), 0);
// Copy the texture
commandList->CopyTextureRegion(&copyDest, 0, 0, 0, &copySrc, nullptr);
@ -918,7 +918,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
&totalResourceSize);
// Round up the srcPitch to multiples of 256
UINT64 dstRowPitch = (fpRowPitch + 255) & ~0xFFu;
const UINT64 dstRowPitch = (fpRowPitch + 255) & ~0xFFu;
if (dstRowPitch > UINT32_MAX)
return HRESULT_E_ARITHMETIC_OVERFLOW;
@ -942,7 +942,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
#endif
// Setup header
const size_t MAX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_DXT10);
constexpr size_t MAX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_DXT10);
uint8_t fileHeader[MAX_HEADER_SIZE] = {};
*reinterpret_cast<uint32_t*>(&fileHeader[0]) = DDS_MAGIC;
@ -1039,7 +1039,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
assert(fpRowCount == rowCount);
assert(fpRowPitch == rowPitch);
UINT64 imageSize = dstRowPitch * UINT64(rowCount);
const UINT64 imageSize = dstRowPitch * UINT64(rowCount);
if (imageSize > UINT32_MAX)
return HRESULT_E_ARITHMETIC_OVERFLOW;
@ -1059,7 +1059,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
uint8_t* dptr = pixels.get();
size_t msize = std::min<size_t>(rowPitch, size_t(dstRowPitch));
const size_t msize = std::min<size_t>(rowPitch, size_t(dstRowPitch));
for (size_t h = 0; h < rowCount; ++h)
{
memcpy(dptr, sptr, msize);
@ -1141,7 +1141,7 @@ HRESULT DirectX::SaveWICTextureToFile(
&totalResourceSize);
// Round up the srcPitch to multiples of 256
UINT64 dstRowPitch = (fpRowPitch + 255) & ~0xFFu;
const UINT64 dstRowPitch = (fpRowPitch + 255) & ~0xFFu;
if (dstRowPitch > UINT32_MAX)
return HRESULT_E_ARITHMETIC_OVERFLOW;
@ -1351,7 +1351,7 @@ HRESULT DirectX::SaveWICTextureToFile(
}
}
UINT64 imageSize = dstRowPitch * UINT64(desc.Height);
const UINT64 imageSize = dstRowPitch * UINT64(desc.Height);
if (imageSize > UINT32_MAX)
return HRESULT_E_ARITHMETIC_OVERFLOW;

View File

@ -474,7 +474,7 @@ namespace
}
else
{
size_t bpp = BitsPerPixel(fmt);
const size_t bpp = BitsPerPixel(fmt);
if (!bpp)
return E_INVALIDARG;
@ -605,13 +605,13 @@ HRESULT DirectX::SaveDDSTextureToFile(
auto_delete_file delonfail(hFile.get());
// Setup header
const size_t MAX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER);
constexpr size_t MAX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER);
uint8_t fileHeader[MAX_HEADER_SIZE] = {};
*reinterpret_cast<uint32_t*>(&fileHeader[0]) = DDS_MAGIC;
auto header = reinterpret_cast<DDS_HEADER*>(&fileHeader[0] + sizeof(uint32_t));
size_t headerSize = sizeof(uint32_t) + sizeof(DDS_HEADER);
constexpr size_t headerSize = sizeof(uint32_t) + sizeof(DDS_HEADER);
header->size = sizeof(DDS_HEADER);
header->flags = DDS_HEADER_FLAGS_TEXTURE | DDS_HEADER_FLAGS_MIPMAP;
header->height = desc.Height;
@ -713,7 +713,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
uint8_t* dptr = pixels.get();
size_t msize = std::min<size_t>(rowPitch, static_cast<size_t>(lockedRect.Pitch));
const size_t msize = std::min<size_t>(rowPitch, static_cast<size_t>(lockedRect.Pitch));
for (size_t h = 0; h < rowCount; ++h)
{
memcpy_s(dptr, rowPitch, sptr, msize);
@ -949,7 +949,7 @@ HRESULT DirectX::SaveWICTextureToFile(
if (FAILED(hr))
return hr;
uint64_t imageSize = uint64_t(lockedRect.Pitch) * uint64_t(desc.Height);
const uint64_t imageSize = uint64_t(lockedRect.Pitch) * uint64_t(desc.Height);
if (imageSize > UINT32_MAX)
{
pSource->UnlockRect();

View File

@ -318,7 +318,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)
{
@ -329,7 +329,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;
@ -346,7 +346,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;
@ -418,7 +418,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);
@ -583,14 +583,14 @@ namespace
}
// Allocate temporary memory for 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);
std::unique_ptr<uint8_t[]> temp(new (std::nothrow) uint8_t[imageSize]);
if (!temp)
@ -777,7 +777,7 @@ namespace
if (texture || textureView)
{
CHAR strFileA[MAX_PATH];
int result = WideCharToMultiByte(CP_UTF8,
const int result = WideCharToMultiByte(CP_UTF8,
WC_NO_BEST_FIT_CHARS,
fileName,
-1,

View File

@ -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(

View File

@ -229,7 +229,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)
{
@ -240,7 +240,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;
@ -257,7 +257,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;
@ -302,7 +302,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);
@ -387,7 +387,7 @@ namespace
if (FAILED(hr))
return hr;
uint64_t numBytes = uint64_t(LockedRect.Pitch) * uint64_t(theight);
const uint64_t numBytes = uint64_t(LockedRect.Pitch) * uint64_t(theight);
pStagingTexture->UnlockRect(0);