Additional C++ Core Checker cleanup

This commit is contained in:
Chuck Walbourn 2018-03-29 12:00:16 -07:00
parent 4724707546
commit 8480f4fe5a
15 changed files with 233 additions and 236 deletions

View File

@ -220,12 +220,10 @@ template <bool bRange> void OptimizeAlpha(float *pX, float *pY, const float *pPo
for (size_t iIteration = 0; iIteration < 8; iIteration++)
{
float fScale;
if ((fY - fX) < (1.0f / 256.0f))
break;
fScale = fSteps / (fY - fX);
float fScale = fSteps / (fY - fX);
// Calculate new steps
float pSteps[8];

View File

@ -589,7 +589,7 @@ HRESULT GPUCompressBC::Compress(const Image& srcImage, const Image& destImage)
HRESULT hr = pContext->Map(m_outputCPU.Get(), 0, D3D11_MAP_READ, 0, &mapped);
if (SUCCEEDED(hr))
{
const uint8_t *pSrc = reinterpret_cast<const uint8_t *>(mapped.pData);
auto pSrc = static_cast<const uint8_t *>(mapped.pData);
uint8_t *pDest = destImage.pixels;
size_t pitch = xblocks * sizeof(BufferBC6HBC7);

View File

@ -58,7 +58,7 @@ namespace
return E_POINTER;
}
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR) * srcImage.width), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR) * srcImage.width), 16)));
if (!scanline)
{
image.Release();
@ -163,7 +163,7 @@ namespace
{
// Convert format and then use as the source image
ScratchImage image;
HRESULT hr;
HRESULT hr = E_UNEXPECTED;
DWORD srgb = GetSRGBFlags(compress);
@ -182,7 +182,6 @@ namespace
break;
default:
hr = E_UNEXPECTED;
break;
}

View File

@ -232,7 +232,7 @@ void DirectX::_CopyScanline(
if (pDestination == pSource)
{
uint32_t *dPtr = reinterpret_cast<uint32_t*> (pDestination);
auto dPtr = static_cast<uint32_t*>(pDestination);
for (size_t count = 0; count < (outSize - 15); count += 16)
{
dPtr += 3;
@ -241,8 +241,8 @@ void DirectX::_CopyScanline(
}
else
{
const uint32_t * __restrict sPtr = reinterpret_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint32_t * __restrict sPtr = static_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
size_t size = std::min<size_t>(outSize, inSize);
for (size_t count = 0; count < (size - 15); count += 16)
{
@ -276,7 +276,7 @@ void DirectX::_CopyScanline(
if (pDestination == pSource)
{
uint16_t *dPtr = reinterpret_cast<uint16_t*>(pDestination);
auto dPtr = static_cast<uint16_t*>(pDestination);
for (size_t count = 0; count < (outSize - 7); count += 8)
{
dPtr += 3;
@ -285,8 +285,8 @@ void DirectX::_CopyScanline(
}
else
{
const uint16_t * __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
uint16_t * __restrict dPtr = reinterpret_cast<uint16_t*>(pDestination);
const uint16_t * __restrict sPtr = static_cast<const uint16_t*>(pSource);
uint16_t * __restrict dPtr = static_cast<uint16_t*>(pDestination);
size_t size = std::min<size_t>(outSize, inSize);
for (size_t count = 0; count < (size - 7); count += 8)
{
@ -313,7 +313,7 @@ void DirectX::_CopyScanline(
{
if (pDestination == pSource)
{
uint32_t *dPtr = reinterpret_cast<uint32_t*>(pDestination);
auto dPtr = static_cast<uint32_t*>(pDestination);
for (size_t count = 0; count < (outSize - 3); count += 4)
{
*dPtr |= 0xC0000000;
@ -322,8 +322,8 @@ void DirectX::_CopyScanline(
}
else
{
const uint32_t * __restrict sPtr = reinterpret_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint32_t * __restrict sPtr = static_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
size_t size = std::min<size_t>(outSize, inSize);
for (size_t count = 0; count < (size - 3); count += 4)
{
@ -350,7 +350,7 @@ void DirectX::_CopyScanline(
if (pDestination == pSource)
{
uint32_t *dPtr = reinterpret_cast<uint32_t*>(pDestination);
auto dPtr = static_cast<uint32_t*>(pDestination);
for (size_t count = 0; count < (outSize - 3); count += 4)
{
uint32_t t = *dPtr & 0xFFFFFF;
@ -360,8 +360,8 @@ void DirectX::_CopyScanline(
}
else
{
const uint32_t * __restrict sPtr = reinterpret_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint32_t * __restrict sPtr = static_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
size_t size = std::min<size_t>(outSize, inSize);
for (size_t count = 0; count < (size - 3); count += 4)
{
@ -379,7 +379,7 @@ void DirectX::_CopyScanline(
{
if (pDestination == pSource)
{
uint16_t *dPtr = reinterpret_cast<uint16_t*>(pDestination);
auto dPtr = static_cast<uint16_t*>(pDestination);
for (size_t count = 0; count < (outSize - 1); count += 2)
{
*(dPtr++) |= 0x8000;
@ -387,8 +387,8 @@ void DirectX::_CopyScanline(
}
else
{
const uint16_t * __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
uint16_t * __restrict dPtr = reinterpret_cast<uint16_t*>(pDestination);
const uint16_t * __restrict sPtr = static_cast<const uint16_t*>(pSource);
uint16_t * __restrict dPtr = static_cast<uint16_t*>(pDestination);
size_t size = std::min<size_t>(outSize, inSize);
for (size_t count = 0; count < (size - 1); count += 2)
{
@ -409,7 +409,7 @@ void DirectX::_CopyScanline(
{
if (pDestination == pSource)
{
uint16_t *dPtr = reinterpret_cast<uint16_t*>(pDestination);
auto dPtr = static_cast<uint16_t*>(pDestination);
for (size_t count = 0; count < (outSize - 1); count += 2)
{
*(dPtr++) |= 0xF000;
@ -417,8 +417,8 @@ void DirectX::_CopyScanline(
}
else
{
const uint16_t * __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
uint16_t * __restrict dPtr = reinterpret_cast<uint16_t*>(pDestination);
const uint16_t * __restrict sPtr = static_cast<const uint16_t*>(pSource);
uint16_t * __restrict dPtr = static_cast<uint16_t*>(pDestination);
size_t size = std::min<size_t>(outSize, inSize);
for (size_t count = 0; count < (size - 1); count += 2)
{
@ -471,7 +471,7 @@ void DirectX::_SwizzleScanline(
// Swap Red (R) and Blue (B) channel (used for D3DFMT_A2R10G10B10 legacy sources)
if (pDestination == pSource)
{
uint32_t *dPtr = reinterpret_cast<uint32_t*>(pDestination);
auto dPtr = static_cast<uint32_t*>(pDestination);
for (size_t count = 0; count < (outSize - 3); count += 4)
{
uint32_t t = *dPtr;
@ -486,8 +486,8 @@ void DirectX::_SwizzleScanline(
}
else
{
const uint32_t * __restrict sPtr = reinterpret_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint32_t * __restrict sPtr = static_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
size_t size = std::min<size_t>(outSize, inSize);
for (size_t count = 0; count < (size - 3); count += 4)
{
@ -521,7 +521,7 @@ void DirectX::_SwizzleScanline(
// Swap Red (R) and Blue (B) channels (used to convert from DXGI 1.1 BGR formats to DXGI 1.0 RGB)
if (pDestination == pSource)
{
uint32_t *dPtr = reinterpret_cast<uint32_t*>(pDestination);
auto dPtr = static_cast<uint32_t*>(pDestination);
for (size_t count = 0; count < (outSize - 3); count += 4)
{
uint32_t t = *dPtr;
@ -536,8 +536,8 @@ void DirectX::_SwizzleScanline(
}
else
{
const uint32_t * __restrict sPtr = reinterpret_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint32_t * __restrict sPtr = static_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
size_t size = std::min<size_t>(outSize, inSize);
for (size_t count = 0; count < (size - 3); count += 4)
{
@ -564,7 +564,7 @@ void DirectX::_SwizzleScanline(
// Reorder YUV components (used to convert legacy UYVY -> YUY2)
if (pDestination == pSource)
{
uint32_t *dPtr = reinterpret_cast<uint32_t*>(pDestination);
auto dPtr = static_cast<uint32_t*>(pDestination);
for (size_t count = 0; count < (outSize - 3); count += 4)
{
uint32_t t = *dPtr;
@ -579,8 +579,8 @@ void DirectX::_SwizzleScanline(
}
else
{
const uint32_t * __restrict sPtr = reinterpret_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint32_t * __restrict sPtr = static_cast<const uint32_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
size_t size = std::min<size_t>(outSize, inSize);
for (size_t count = 0; count < (size - 3); count += 4)
{
@ -637,8 +637,8 @@ bool DirectX::_ExpandScanline(
// DXGI_FORMAT_B5G6R5_UNORM -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 2 && outSize >= 4)
{
const uint16_t * __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint16_t * __restrict sPtr = static_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < (inSize - 1)) && (ocount < (outSize - 3))); icount += 2, ocount += 4)
{
@ -661,8 +661,8 @@ bool DirectX::_ExpandScanline(
// DXGI_FORMAT_B5G5R5A1_UNORM -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 2 && outSize >= 4)
{
const uint16_t * __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint16_t * __restrict sPtr = static_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < (inSize - 1)) && (ocount < (outSize - 3))); icount += 2, ocount += 4)
{
@ -686,8 +686,8 @@ bool DirectX::_ExpandScanline(
// DXGI_FORMAT_B4G4R4A4_UNORM -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 2 && outSize >= 4)
{
const uint16_t * __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint16_t * __restrict sPtr = static_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < (inSize - 1)) && (ocount < (outSize - 3))); icount += 2, ocount += 4)
{
@ -825,7 +825,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
const size_t psize = sizeof(float) + sizeof(uint32_t);
if (size >= psize)
{
const float * sPtr = reinterpret_cast<const float*>(pSource);
auto sPtr = static_cast<const float*>(pSource);
for (size_t icount = 0; icount < (size - psize + 1); icount += psize)
{
const uint8_t* ps8 = reinterpret_cast<const uint8_t*>(&sPtr[1]);
@ -843,7 +843,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
const size_t psize = sizeof(float) + sizeof(uint32_t);
if (size >= psize)
{
const float * sPtr = reinterpret_cast<const float*>(pSource);
auto sPtr = static_cast<const float*>(pSource);
for (size_t icount = 0; icount < (size - psize + 1); icount += psize)
{
if (dPtr >= ePtr) break;
@ -860,7 +860,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
const size_t psize = sizeof(float) + sizeof(uint32_t);
if (size >= psize)
{
const float * sPtr = reinterpret_cast<const float*>(pSource);
auto sPtr = static_cast<const float*>(pSource);
for (size_t icount = 0; icount < (size - psize + 1); icount += psize)
{
const uint8_t* pg8 = reinterpret_cast<const uint8_t*>(&sPtr[1]);
@ -917,7 +917,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R32_FLOAT:
if (size >= sizeof(float))
{
const float* __restrict sPtr = reinterpret_cast<const float*>(pSource);
const float* __restrict sPtr = static_cast<const float*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(float) + 1); icount += sizeof(float))
{
XMVECTOR v = XMLoadFloat(sPtr++);
@ -931,7 +931,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R32_UINT:
if (size >= sizeof(uint32_t))
{
const uint32_t* __restrict sPtr = reinterpret_cast<const uint32_t*>(pSource);
const uint32_t* __restrict sPtr = static_cast<const uint32_t*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(uint32_t) + 1); icount += sizeof(uint32_t))
{
XMVECTOR v = XMLoadInt(sPtr++);
@ -946,10 +946,10 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R32_SINT:
if (size >= sizeof(int32_t))
{
const int32_t * __restrict sPtr = reinterpret_cast<const int32_t*>(pSource);
const int32_t * __restrict sPtr = static_cast<const int32_t*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(int32_t) + 1); icount += sizeof(int32_t))
{
XMVECTOR v = XMLoadInt(reinterpret_cast<const uint32_t*> (sPtr++));
XMVECTOR v = XMLoadInt(reinterpret_cast<const uint32_t*>(sPtr++));
v = XMConvertVectorIntToFloat(v, 0);
if (dPtr >= ePtr) break;
*(dPtr++) = XMVectorSelect(g_XMIdentityR3, v, g_XMSelect1000);
@ -961,7 +961,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_D24_UNORM_S8_UINT:
if (size >= sizeof(uint32_t))
{
const uint32_t * sPtr = reinterpret_cast<const uint32_t*>(pSource);
auto sPtr = static_cast<const uint32_t*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(uint32_t) + 1); icount += sizeof(uint32_t))
{
float d = static_cast<float>(*sPtr & 0xFFFFFF) / 16777215.f;
@ -977,7 +977,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
if (size >= sizeof(uint32_t))
{
const uint32_t * sPtr = reinterpret_cast<const uint32_t*>(pSource);
auto sPtr = static_cast<const uint32_t*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(uint32_t) + 1); icount += sizeof(uint32_t))
{
float r = static_cast<float>(*sPtr & 0xFFFFFF) / 16777215.f;
@ -992,7 +992,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
if (size >= sizeof(uint32_t))
{
const uint32_t * sPtr = reinterpret_cast<const uint32_t*>(pSource);
auto sPtr = static_cast<const uint32_t*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(uint32_t) + 1); icount += sizeof(uint32_t))
{
float g = static_cast<float>((*sPtr & 0xFF000000) >> 24);
@ -1019,7 +1019,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R16_FLOAT:
if (size >= sizeof(HALF))
{
const HALF * __restrict sPtr = reinterpret_cast<const HALF*>(pSource);
const HALF * __restrict sPtr = static_cast<const HALF*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(HALF) + 1); icount += sizeof(HALF))
{
if (dPtr >= ePtr) break;
@ -1033,7 +1033,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R16_UNORM:
if (size >= sizeof(uint16_t))
{
const uint16_t* __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
const uint16_t* __restrict sPtr = static_cast<const uint16_t*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(uint16_t) + 1); icount += sizeof(uint16_t))
{
if (dPtr >= ePtr) break;
@ -1046,7 +1046,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R16_UINT:
if (size >= sizeof(uint16_t))
{
const uint16_t * __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
const uint16_t * __restrict sPtr = static_cast<const uint16_t*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(uint16_t) + 1); icount += sizeof(uint16_t))
{
if (dPtr >= ePtr) break;
@ -1059,7 +1059,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R16_SNORM:
if (size >= sizeof(int16_t))
{
const int16_t * __restrict sPtr = reinterpret_cast<const int16_t*>(pSource);
const int16_t * __restrict sPtr = static_cast<const int16_t*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(int16_t) + 1); icount += sizeof(int16_t))
{
if (dPtr >= ePtr) break;
@ -1072,7 +1072,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R16_SINT:
if (size >= sizeof(int16_t))
{
const int16_t * __restrict sPtr = reinterpret_cast<const int16_t*>(pSource);
const int16_t * __restrict sPtr = static_cast<const int16_t*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(int16_t) + 1); icount += sizeof(int16_t))
{
if (dPtr >= ePtr) break;
@ -1085,7 +1085,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R8_UNORM:
if (size >= sizeof(uint8_t))
{
const uint8_t * __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
const uint8_t * __restrict sPtr = static_cast<const uint8_t*>(pSource);
for (size_t icount = 0; icount < size; icount += sizeof(uint8_t))
{
if (dPtr >= ePtr) break;
@ -1098,7 +1098,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R8_UINT:
if (size >= sizeof(uint8_t))
{
const uint8_t * __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
const uint8_t * __restrict sPtr = static_cast<const uint8_t*>(pSource);
for (size_t icount = 0; icount < size; icount += sizeof(uint8_t))
{
if (dPtr >= ePtr) break;
@ -1111,7 +1111,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R8_SNORM:
if (size >= sizeof(int8_t))
{
const int8_t * __restrict sPtr = reinterpret_cast<const int8_t*>(pSource);
const int8_t * __restrict sPtr = static_cast<const int8_t*>(pSource);
for (size_t icount = 0; icount < size; icount += sizeof(int8_t))
{
if (dPtr >= ePtr) break;
@ -1124,7 +1124,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R8_SINT:
if (size >= sizeof(int8_t))
{
const int8_t * __restrict sPtr = reinterpret_cast<const int8_t*>(pSource);
const int8_t * __restrict sPtr = static_cast<const int8_t*>(pSource);
for (size_t icount = 0; icount < size; icount += sizeof(int8_t))
{
if (dPtr >= ePtr) break;
@ -1137,7 +1137,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_A8_UNORM:
if (size >= sizeof(uint8_t))
{
const uint8_t * __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
const uint8_t * __restrict sPtr = static_cast<const uint8_t*>(pSource);
for (size_t icount = 0; icount < size; icount += sizeof(uint8_t))
{
if (dPtr >= ePtr) break;
@ -1150,7 +1150,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R1_UNORM:
if (size >= sizeof(uint8_t))
{
const uint8_t * __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
const uint8_t * __restrict sPtr = static_cast<const uint8_t*>(pSource);
for (size_t icount = 0; icount < size; icount += sizeof(uint8_t))
{
for (size_t bcount = 8; bcount > 0; --bcount)
@ -1171,7 +1171,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_R8G8_B8G8_UNORM:
if (size >= sizeof(XMUBYTEN4))
{
const XMUBYTEN4 * __restrict sPtr = reinterpret_cast<const XMUBYTEN4*>(pSource);
const XMUBYTEN4 * __restrict sPtr = static_cast<const XMUBYTEN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
XMVECTOR v = XMLoadUByteN4(sPtr++);
@ -1188,7 +1188,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_G8R8_G8B8_UNORM:
if (size >= sizeof(XMUBYTEN4))
{
const XMUBYTEN4 * __restrict sPtr = reinterpret_cast<const XMUBYTEN4*>(pSource);
const XMUBYTEN4 * __restrict sPtr = static_cast<const XMUBYTEN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
XMVECTOR v = XMLoadUByteN4(sPtr++);
@ -1207,7 +1207,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
if (size >= sizeof(XMU565))
{
static const XMVECTORF32 s_Scale = { { { 1.f / 31.f, 1.f / 63.f, 1.f / 31.f, 1.f } } };
const XMU565 * __restrict sPtr = reinterpret_cast<const XMU565*>(pSource);
const XMU565 * __restrict sPtr = static_cast<const XMU565*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMU565) + 1); icount += sizeof(XMU565))
{
XMVECTOR v = XMLoadU565(sPtr++);
@ -1224,7 +1224,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
if (size >= sizeof(XMU555))
{
static const XMVECTORF32 s_Scale = { { { 1.f / 31.f, 1.f / 31.f, 1.f / 31.f, 1.f } } };
const XMU555 * __restrict sPtr = reinterpret_cast<const XMU555*>(pSource);
const XMU555 * __restrict sPtr = static_cast<const XMU555*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMU555) + 1); icount += sizeof(XMU555))
{
XMVECTOR v = XMLoadU555(sPtr++);
@ -1240,7 +1240,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
if (size >= sizeof(XMUBYTEN4))
{
const XMUBYTEN4 * __restrict sPtr = reinterpret_cast<const XMUBYTEN4*>(pSource);
const XMUBYTEN4 * __restrict sPtr = static_cast<const XMUBYTEN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
XMVECTOR v = XMLoadUByteN4(sPtr++);
@ -1255,7 +1255,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
if (size >= sizeof(XMUBYTEN4))
{
const XMUBYTEN4 * __restrict sPtr = reinterpret_cast<const XMUBYTEN4*>(pSource);
const XMUBYTEN4 * __restrict sPtr = static_cast<const XMUBYTEN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
XMVECTOR v = XMLoadUByteN4(sPtr++);
@ -1270,7 +1270,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_AYUV:
if (size >= sizeof(XMUBYTEN4))
{
const XMUBYTEN4 * __restrict sPtr = reinterpret_cast<const XMUBYTEN4*>(pSource);
const XMUBYTEN4 * __restrict sPtr = static_cast<const XMUBYTEN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
int v = int(sPtr->x) - 128;
@ -1306,7 +1306,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_Y410:
if (size >= sizeof(XMUDECN4))
{
const XMUDECN4 * __restrict sPtr = reinterpret_cast<const XMUDECN4*>(pSource);
const XMUDECN4 * __restrict sPtr = static_cast<const XMUDECN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUDECN4) + 1); icount += sizeof(XMUDECN4))
{
int64_t u = int(sPtr->x) - 512;
@ -1342,7 +1342,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_Y416:
if (size >= sizeof(XMUSHORTN4))
{
const XMUSHORTN4 * __restrict sPtr = reinterpret_cast<const XMUSHORTN4*>(pSource);
const XMUSHORTN4 * __restrict sPtr = static_cast<const XMUSHORTN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUSHORTN4) + 1); icount += sizeof(XMUSHORTN4))
{
int64_t u = int64_t(sPtr->x) - 32768;
@ -1378,7 +1378,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_YUY2:
if (size >= sizeof(XMUBYTEN4))
{
const XMUBYTEN4 * __restrict sPtr = reinterpret_cast<const XMUBYTEN4*>(pSource);
const XMUBYTEN4 * __restrict sPtr = static_cast<const XMUBYTEN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
int y0 = int(sPtr->x) - 16;
@ -1416,7 +1416,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
// Same as Y216 with least significant 6 bits set to zero
if (size >= sizeof(XMUSHORTN4))
{
const XMUSHORTN4 * __restrict sPtr = reinterpret_cast<const XMUSHORTN4*>(pSource);
const XMUSHORTN4 * __restrict sPtr = static_cast<const XMUSHORTN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUSHORTN4) + 1); icount += sizeof(XMUSHORTN4))
{
int64_t y0 = int64_t(sPtr->x >> 6) - 64;
@ -1453,7 +1453,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
case DXGI_FORMAT_Y216:
if (size >= sizeof(XMUSHORTN4))
{
const XMUSHORTN4 * __restrict sPtr = reinterpret_cast<const XMUSHORTN4*>(pSource);
const XMUSHORTN4 * __restrict sPtr = static_cast<const XMUSHORTN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUSHORTN4) + 1); icount += sizeof(XMUSHORTN4))
{
int64_t y0 = int64_t(sPtr->x) - 4096;
@ -1491,7 +1491,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
if (size >= sizeof(XMUNIBBLE4))
{
static const XMVECTORF32 s_Scale = { { { 1.f / 15.f, 1.f / 15.f, 1.f / 15.f, 1.f / 15.f } } };
const XMUNIBBLE4 * __restrict sPtr = reinterpret_cast<const XMUNIBBLE4*>(pSource);
const XMUNIBBLE4 * __restrict sPtr = static_cast<const XMUNIBBLE4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUNIBBLE4) + 1); icount += sizeof(XMUNIBBLE4))
{
XMVECTOR v = XMLoadUNibble4(sPtr++);
@ -1507,7 +1507,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
// Xbox One specific 7e3 format
if (size >= sizeof(XMUDECN4))
{
const XMUDECN4 * __restrict sPtr = reinterpret_cast<const XMUDECN4*>(pSource);
const XMUDECN4 * __restrict sPtr = static_cast<const XMUDECN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUDECN4) + 1); icount += sizeof(XMUDECN4))
{
if (dPtr >= ePtr) break;
@ -1531,7 +1531,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
// Xbox One specific 6e4 format
if (size >= sizeof(XMUDECN4))
{
const XMUDECN4 * __restrict sPtr = reinterpret_cast<const XMUDECN4*>(pSource);
const XMUDECN4 * __restrict sPtr = static_cast<const XMUDECN4*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(XMUDECN4) + 1); icount += sizeof(XMUDECN4))
{
if (dPtr >= ePtr) break;
@ -1560,7 +1560,7 @@ _Use_decl_annotations_ bool DirectX::_LoadScanline(
if (size >= sizeof(uint8_t))
{
static const XMVECTORF32 s_Scale = { { { 1.f / 15.f, 1.f / 15.f, 0.f, 0.f } } };
const uint8_t * __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
const uint8_t * __restrict sPtr = static_cast<const uint8_t*>(pSource);
for (size_t icount = 0; icount < (size - sizeof(uint8_t) + 1); icount += sizeof(uint8_t))
{
XMUNIBBLE4 nibble;
@ -1644,7 +1644,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R16G16B16A16_FLOAT:
if (size >= sizeof(XMHALF4))
{
XMHALF4* __restrict dPtr = reinterpret_cast<XMHALF4*>(pDestination);
XMHALF4* __restrict dPtr = static_cast<XMHALF4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMHALF4) + 1); icount += sizeof(XMHALF4))
{
if (sPtr >= ePtr) break;
@ -1682,7 +1682,7 @@ bool DirectX::_StoreScanline(
const size_t psize = sizeof(float) + sizeof(uint32_t);
if (size >= psize)
{
float *dPtr = reinterpret_cast<float*>(pDestination);
auto dPtr = static_cast<float*>(pDestination);
for (size_t icount = 0; icount < (size - psize + 1); icount += psize)
{
if (sPtr >= ePtr) break;
@ -1715,7 +1715,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
if (size >= sizeof(XMUBYTEN4))
{
XMUBYTEN4 * __restrict dPtr = reinterpret_cast<XMUBYTEN4*>(pDestination);
XMUBYTEN4 * __restrict dPtr = static_cast<XMUBYTEN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
if (sPtr >= ePtr) break;
@ -1738,7 +1738,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R16G16_FLOAT:
if (size >= sizeof(XMHALF2))
{
XMHALF2* __restrict dPtr = reinterpret_cast<XMHALF2*>(pDestination);
XMHALF2* __restrict dPtr = static_cast<XMHALF2*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMHALF2) + 1); icount += sizeof(XMHALF2))
{
if (sPtr >= ePtr) break;
@ -1766,7 +1766,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R32_FLOAT:
if (size >= sizeof(float))
{
float * __restrict dPtr = reinterpret_cast<float*>(pDestination);
float * __restrict dPtr = static_cast<float*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(float) + 1); icount += sizeof(float))
{
if (sPtr >= ePtr) break;
@ -1779,7 +1779,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R32_UINT:
if (size >= sizeof(uint32_t))
{
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(uint32_t) + 1); icount += sizeof(uint32_t))
{
if (sPtr >= ePtr) break;
@ -1793,7 +1793,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R32_SINT:
if (size >= sizeof(int32_t))
{
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(int32_t) + 1); icount += sizeof(int32_t))
{
if (sPtr >= ePtr) break;
@ -1809,7 +1809,7 @@ bool DirectX::_StoreScanline(
{
static const XMVECTORF32 clamp = { { { 1.f, 255.f, 0.f, 0.f } } };
XMVECTOR zero = XMVectorZero();
uint32_t *dPtr = reinterpret_cast<uint32_t*>(pDestination);
auto dPtr = static_cast<uint32_t*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(uint32_t) + 1); icount += sizeof(uint32_t))
{
if (sPtr >= ePtr) break;
@ -1837,7 +1837,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R16_FLOAT:
if (size >= sizeof(HALF))
{
HALF * __restrict dPtr = reinterpret_cast<HALF*>(pDestination);
HALF * __restrict dPtr = static_cast<HALF*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(HALF) + 1); icount += sizeof(HALF))
{
if (sPtr >= ePtr) break;
@ -1853,7 +1853,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R16_UNORM:
if (size >= sizeof(uint16_t))
{
uint16_t * __restrict dPtr = reinterpret_cast<uint16_t*>(pDestination);
uint16_t * __restrict dPtr = static_cast<uint16_t*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(uint16_t) + 1); icount += sizeof(uint16_t))
{
if (sPtr >= ePtr) break;
@ -1868,7 +1868,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R16_UINT:
if (size >= sizeof(uint16_t))
{
uint16_t * __restrict dPtr = reinterpret_cast<uint16_t*>(pDestination);
uint16_t * __restrict dPtr = static_cast<uint16_t*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(uint16_t) + 1); icount += sizeof(uint16_t))
{
if (sPtr >= ePtr) break;
@ -1883,7 +1883,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R16_SNORM:
if (size >= sizeof(int16_t))
{
int16_t * __restrict dPtr = reinterpret_cast<int16_t*>(pDestination);
int16_t * __restrict dPtr = static_cast<int16_t*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(int16_t) + 1); icount += sizeof(int16_t))
{
if (sPtr >= ePtr) break;
@ -1898,7 +1898,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R16_SINT:
if (size >= sizeof(int16_t))
{
int16_t * __restrict dPtr = reinterpret_cast<int16_t*>(pDestination);
int16_t * __restrict dPtr = static_cast<int16_t*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(int16_t) + 1); icount += sizeof(int16_t))
{
if (sPtr >= ePtr) break;
@ -1913,7 +1913,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R8_UNORM:
if (size >= sizeof(uint8_t))
{
uint8_t * __restrict dPtr = reinterpret_cast<uint8_t*>(pDestination);
uint8_t * __restrict dPtr = static_cast<uint8_t*>(pDestination);
for (size_t icount = 0; icount < size; icount += sizeof(uint8_t))
{
if (sPtr >= ePtr) break;
@ -1928,7 +1928,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R8_UINT:
if (size >= sizeof(uint8_t))
{
uint8_t * __restrict dPtr = reinterpret_cast<uint8_t*>(pDestination);
uint8_t * __restrict dPtr = static_cast<uint8_t*>(pDestination);
for (size_t icount = 0; icount < size; icount += sizeof(uint8_t))
{
if (sPtr >= ePtr) break;
@ -1943,7 +1943,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R8_SNORM:
if (size >= sizeof(int8_t))
{
int8_t * __restrict dPtr = reinterpret_cast<int8_t*>(pDestination);
int8_t * __restrict dPtr = static_cast<int8_t*>(pDestination);
for (size_t icount = 0; icount < size; icount += sizeof(int8_t))
{
if (sPtr >= ePtr) break;
@ -1958,7 +1958,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R8_SINT:
if (size >= sizeof(int8_t))
{
int8_t * __restrict dPtr = reinterpret_cast<int8_t*>(pDestination);
int8_t * __restrict dPtr = static_cast<int8_t*>(pDestination);
for (size_t icount = 0; icount < size; icount += sizeof(int8_t))
{
if (sPtr >= ePtr) break;
@ -1973,7 +1973,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_A8_UNORM:
if (size >= sizeof(uint8_t))
{
uint8_t * __restrict dPtr = reinterpret_cast<uint8_t*>(pDestination);
uint8_t * __restrict dPtr = static_cast<uint8_t*>(pDestination);
for (size_t icount = 0; icount < size; icount += sizeof(uint8_t))
{
if (sPtr >= ePtr) break;
@ -1988,7 +1988,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R1_UNORM:
if (size >= sizeof(uint8_t))
{
uint8_t * __restrict dPtr = reinterpret_cast<uint8_t*>(pDestination);
uint8_t * __restrict dPtr = static_cast<uint8_t*>(pDestination);
for (size_t icount = 0; icount < size; icount += sizeof(uint8_t))
{
uint8_t pixels = 0;
@ -2015,7 +2015,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_R8G8_B8G8_UNORM:
if (size >= sizeof(XMUBYTEN4))
{
XMUBYTEN4 * __restrict dPtr = reinterpret_cast<XMUBYTEN4*>(pDestination);
XMUBYTEN4 * __restrict dPtr = static_cast<XMUBYTEN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
if (sPtr >= ePtr) break;
@ -2034,7 +2034,7 @@ bool DirectX::_StoreScanline(
{
static XMVECTORU32 select1101 = { { { XM_SELECT_1, XM_SELECT_1, XM_SELECT_0, XM_SELECT_1 } } };
XMUBYTEN4 * __restrict dPtr = reinterpret_cast<XMUBYTEN4*>(pDestination);
XMUBYTEN4 * __restrict dPtr = static_cast<XMUBYTEN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
if (sPtr >= ePtr) break;
@ -2052,7 +2052,7 @@ bool DirectX::_StoreScanline(
if (size >= sizeof(XMU565))
{
static const XMVECTORF32 s_Scale = { { { 31.f, 63.f, 31.f, 1.f } } };
XMU565 * __restrict dPtr = reinterpret_cast<XMU565*>(pDestination);
XMU565 * __restrict dPtr = static_cast<XMU565*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMU565) + 1); icount += sizeof(XMU565))
{
if (sPtr >= ePtr) break;
@ -2068,7 +2068,7 @@ bool DirectX::_StoreScanline(
if (size >= sizeof(XMU555))
{
static const XMVECTORF32 s_Scale = { { { 31.f, 31.f, 31.f, 1.f } } };
XMU555 * __restrict dPtr = reinterpret_cast<XMU555*>(pDestination);
XMU555 * __restrict dPtr = static_cast<XMU555*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMU555) + 1); icount += sizeof(XMU555))
{
if (sPtr >= ePtr) break;
@ -2086,7 +2086,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
if (size >= sizeof(XMUBYTEN4))
{
XMUBYTEN4 * __restrict dPtr = reinterpret_cast<XMUBYTEN4*>(pDestination);
XMUBYTEN4 * __restrict dPtr = static_cast<XMUBYTEN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
if (sPtr >= ePtr) break;
@ -2102,7 +2102,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
if (size >= sizeof(XMUBYTEN4))
{
XMUBYTEN4 * __restrict dPtr = reinterpret_cast<XMUBYTEN4*>(pDestination);
XMUBYTEN4 * __restrict dPtr = static_cast<XMUBYTEN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
if (sPtr >= ePtr) break;
@ -2117,7 +2117,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_AYUV:
if (size >= sizeof(XMUBYTEN4))
{
XMUBYTEN4 * __restrict dPtr = reinterpret_cast<XMUBYTEN4*>(pDestination);
XMUBYTEN4 * __restrict dPtr = static_cast<XMUBYTEN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
if (sPtr >= ePtr) break;
@ -2148,7 +2148,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_Y410:
if (size >= sizeof(XMUDECN4))
{
XMUDECN4 * __restrict dPtr = reinterpret_cast<XMUDECN4*>(pDestination);
XMUDECN4 * __restrict dPtr = static_cast<XMUDECN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUDECN4) + 1); icount += sizeof(XMUDECN4))
{
if (sPtr >= ePtr) break;
@ -2183,7 +2183,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_Y416:
if (size >= sizeof(XMUSHORTN4))
{
XMUSHORTN4 * __restrict dPtr = reinterpret_cast<XMUSHORTN4*>(pDestination);
XMUSHORTN4 * __restrict dPtr = static_cast<XMUSHORTN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUSHORTN4) + 1); icount += sizeof(XMUSHORTN4))
{
if (sPtr >= ePtr) break;
@ -2218,7 +2218,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_YUY2:
if (size >= sizeof(XMUBYTEN4))
{
XMUBYTEN4 * __restrict dPtr = reinterpret_cast<XMUBYTEN4*>(pDestination);
XMUBYTEN4 * __restrict dPtr = static_cast<XMUBYTEN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUBYTEN4) + 1); icount += sizeof(XMUBYTEN4))
{
if (sPtr >= ePtr) break;
@ -2259,7 +2259,7 @@ bool DirectX::_StoreScanline(
// Same as Y216 with least significant 6 bits set to zero
if (size >= sizeof(XMUSHORTN4))
{
XMUSHORTN4 * __restrict dPtr = reinterpret_cast<XMUSHORTN4*>(pDestination);
XMUSHORTN4 * __restrict dPtr = static_cast<XMUSHORTN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUSHORTN4) + 1); icount += sizeof(XMUSHORTN4))
{
if (sPtr >= ePtr) break;
@ -2307,7 +2307,7 @@ bool DirectX::_StoreScanline(
case DXGI_FORMAT_Y216:
if (size >= sizeof(XMUSHORTN4))
{
XMUSHORTN4 * __restrict dPtr = reinterpret_cast<XMUSHORTN4*>(pDestination);
XMUSHORTN4 * __restrict dPtr = static_cast<XMUSHORTN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUSHORTN4) + 1); icount += sizeof(XMUSHORTN4))
{
if (sPtr >= ePtr) break;
@ -2356,7 +2356,7 @@ bool DirectX::_StoreScanline(
if (size >= sizeof(XMUNIBBLE4))
{
static const XMVECTORF32 s_Scale = { { { 15.f, 15.f, 15.f, 15.f } } };
XMUNIBBLE4 * __restrict dPtr = reinterpret_cast<XMUNIBBLE4*>(pDestination);
XMUNIBBLE4 * __restrict dPtr = static_cast<XMUNIBBLE4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUNIBBLE4) + 1); icount += sizeof(XMUNIBBLE4))
{
if (sPtr >= ePtr) break;
@ -2375,7 +2375,7 @@ bool DirectX::_StoreScanline(
static const XMVECTORF32 Scale = { { { 1.0f, 1.0f, 1.0f, 3.0f } } };
static const XMVECTORF32 C = { { { 31.875f, 31.875f, 31.875f, 3.f } } };
XMUDECN4 * __restrict dPtr = reinterpret_cast<XMUDECN4*>(pDestination);
XMUDECN4 * __restrict dPtr = static_cast<XMUDECN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUDECN4) + 1); icount += sizeof(XMUDECN4))
{
if (sPtr >= ePtr) break;
@ -2389,7 +2389,7 @@ bool DirectX::_StoreScanline(
dPtr->x = FloatTo7e3(tmp.x);
dPtr->y = FloatTo7e3(tmp.y);
dPtr->z = FloatTo7e3(tmp.z);
dPtr->w = (uint32_t)tmp.w;
dPtr->w = static_cast<uint32_t>(tmp.w);
++dPtr;
}
return true;
@ -2403,7 +2403,7 @@ bool DirectX::_StoreScanline(
static const XMVECTORF32 Scale = { { { 1.0f, 1.0f, 1.0f, 3.0f } } };
static const XMVECTORF32 C = { { { 508.f, 508.f, 508.f, 3.f } } };
XMUDECN4 * __restrict dPtr = reinterpret_cast<XMUDECN4*>(pDestination);
XMUDECN4 * __restrict dPtr = static_cast<XMUDECN4*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(XMUDECN4) + 1); icount += sizeof(XMUDECN4))
{
if (sPtr >= ePtr) break;
@ -2433,7 +2433,7 @@ bool DirectX::_StoreScanline(
if (size >= sizeof(uint8_t))
{
static const XMVECTORF32 s_Scale = { { { 15.f, 15.f, 0.f, 0.f } } };
uint8_t * __restrict dPtr = reinterpret_cast<uint8_t*>(pDestination);
uint8_t * __restrict dPtr = static_cast<uint8_t*>(pDestination);
for (size_t icount = 0; icount < (size - sizeof(uint8_t) + 1); icount += sizeof(uint8_t))
{
if (sPtr >= ePtr) break;
@ -2885,8 +2885,8 @@ namespace
int __cdecl ConvertCompare(void *context, const void* ptr1, const void *ptr2) DIRECTX_NOEXCEPT
{
UNREFERENCED_PARAMETER(context);
const ConvertData *p1 = reinterpret_cast<const ConvertData*>(ptr1);
const ConvertData *p2 = reinterpret_cast<const ConvertData*>(ptr2);
auto p1 = static_cast<const ConvertData*>(ptr1);
auto p2 = static_cast<const ConvertData*>(ptr2);
if (p1->format == p2->format) return 0;
else return (p1->format < p2->format) ? -1 : 1;
}
@ -3844,7 +3844,7 @@ bool DirectX::_StoreScanlineDither(
if (!sPtr)
return false;
const void* ePtr = reinterpret_cast<const uint8_t*>(pDestination) + size;
const void* ePtr = static_cast<const uint8_t*>(pDestination) + size;
XMVECTOR vError = XMVectorZero();
@ -3876,7 +3876,7 @@ bool DirectX::_StoreScanlineDither(
static const XMVECTORF32 MinXR = { { { -0.7529f, -0.7529f, -0.7529f, 0.f } } };
static const XMVECTORF32 MaxXR = { { { 1.2529f, 1.2529f, 1.2529f, 1.0f } } };
XMUDEC4 * __restrict dest = reinterpret_cast<XMUDEC4*>(pDestination);
XMUDEC4 * __restrict dest = static_cast<XMUDEC4*>(pDestination);
for (size_t i = 0; i < count; ++i)
{
ptrdiff_t index = static_cast<ptrdiff_t>((y & 1) ? (count - i - 1) : i);
@ -3954,7 +3954,7 @@ bool DirectX::_StoreScanlineDither(
static const XMVECTORF32 Scale = { { { 16777215.f, 1.f, 0.f, 0.f } } };
static const XMVECTORF32 Scale2 = { { { 16777215.f, 255.f, 0.f, 0.f } } };
uint32_t * __restrict dest = reinterpret_cast<uint32_t*>(pDestination);
uint32_t * __restrict dest = static_cast<uint32_t*>(pDestination);
for (size_t i = 0; i < count; ++i)
{
ptrdiff_t index = static_cast<ptrdiff_t>((y & 1) ? (count - i - 1) : i);
@ -4041,7 +4041,7 @@ bool DirectX::_StoreScanlineDither(
case DXGI_FORMAT_B5G6R5_UNORM:
if (size >= sizeof(XMU565))
{
XMU565 * __restrict dest = reinterpret_cast<XMU565*>(pDestination);
XMU565 * __restrict dest = static_cast<XMU565*>(pDestination);
for (size_t i = 0; i < count; ++i)
{
ptrdiff_t index = static_cast<ptrdiff_t>((y & 1) ? (count - i - 1) : i);
@ -4090,7 +4090,7 @@ bool DirectX::_StoreScanlineDither(
case DXGI_FORMAT_B5G5R5A1_UNORM:
if (size >= sizeof(XMU555))
{
XMU555 * __restrict dest = reinterpret_cast<XMU555*>(pDestination);
XMU555 * __restrict dest = static_cast<XMU555*>(pDestination);
for (size_t i = 0; i < count; ++i)
{
ptrdiff_t index = static_cast<ptrdiff_t>((y & 1) ? (count - i - 1) : i);
@ -4145,7 +4145,7 @@ bool DirectX::_StoreScanlineDither(
case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
if (size >= sizeof(XMUBYTEN4))
{
XMUBYTEN4 * __restrict dest = reinterpret_cast<XMUBYTEN4*>(pDestination);
XMUBYTEN4 * __restrict dest = static_cast<XMUBYTEN4*>(pDestination);
for (size_t i = 0; i < count; ++i)
{
ptrdiff_t index = static_cast<ptrdiff_t>((y & 1) ? (count - i - 1) : i);
@ -4201,7 +4201,7 @@ bool DirectX::_StoreScanlineDither(
case XBOX_DXGI_FORMAT_R4G4_UNORM:
if (size >= sizeof(uint8_t))
{
uint8_t * __restrict dest = reinterpret_cast<uint8_t*>(pDestination);
uint8_t * __restrict dest = static_cast<uint8_t*>(pDestination);
for (size_t i = 0; i < count; ++i)
{
ptrdiff_t index = static_cast<ptrdiff_t>((y & 1) ? (count - i - 1) : i);
@ -4464,7 +4464,7 @@ namespace
if (filter & TEX_FILTER_DITHER_DIFFUSION)
{
// Error diffusion dithering (aka Floyd-Steinberg dithering)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*(width * 2 + 2)), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*(width * 2 + 2)), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -4487,7 +4487,7 @@ namespace
}
else
{
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width), 16)));
if (!scanline)
return E_OUTOFMEMORY;

View File

@ -81,7 +81,7 @@ namespace
if (FAILED(hr))
return hr;
auto pslice = reinterpret_cast<const uint8_t*>(mapped.pData);
auto pslice = static_cast<const uint8_t*>(mapped.pData);
if (!pslice)
{
pContext->Unmap(pSource, dindex);
@ -169,7 +169,7 @@ namespace
return E_UNEXPECTED;
}
auto sptr = reinterpret_cast<const uint8_t*>(mapped.pData);
auto sptr = static_cast<const uint8_t*>(mapped.pData);
uint8_t* dptr = img->pixels;
for (size_t h = 0; h < lines; ++h)
{
@ -537,7 +537,7 @@ HRESULT DirectX::CreateTextureEx(
}
// Create texture using static initialization data
HRESULT hr = E_FAIL;
HRESULT hr = E_UNEXPECTED;
DXGI_FORMAT tformat = (forceSRGB) ? MakeSRGB(metadata.format) : metadata.format;
@ -734,7 +734,7 @@ HRESULT DirectX::CaptureTexture(
D3D11_RESOURCE_DIMENSION resType = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pSource->GetType(&resType);
HRESULT hr;
HRESULT hr = E_UNEXPECTED;
switch (resType)
{

View File

@ -281,7 +281,7 @@ namespace
}
// DDS files always start with the same magic number ("DDS ")
uint32_t dwMagicNumber = *reinterpret_cast<const uint32_t*>(pSource);
auto dwMagicNumber = *static_cast<const uint32_t*>(pSource);
if (dwMagicNumber != DDS_MAGIC)
{
return E_FAIL;
@ -618,9 +618,9 @@ HRESULT DirectX::_EncodeDDSHeader(
if (maxsize < required)
return E_NOT_SUFFICIENT_BUFFER;
*reinterpret_cast<uint32_t*>(pDestination) = DDS_MAGIC;
*static_cast<uint32_t*>(pDestination) = DDS_MAGIC;
auto header = reinterpret_cast<DDS_HEADER*>(reinterpret_cast<uint8_t*>(pDestination) + sizeof(uint32_t));
auto header = reinterpret_cast<DDS_HEADER*>(static_cast<uint8_t*>(pDestination) + sizeof(uint32_t));
assert(header);
memset(header, 0, sizeof(DDS_HEADER));
@ -827,8 +827,8 @@ namespace
// D3DFMT_R8G8B8 -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 3 && outSize >= 4)
{
const uint8_t * __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint8_t * __restrict sPtr = static_cast<const uint8_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < (inSize - 2)) && (ocount < (outSize - 3))); icount += 3, ocount += 4)
{
@ -851,8 +851,8 @@ namespace
// D3DFMT_R3G3B2 -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 1 && outSize >= 4)
{
const uint8_t* __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint8_t* __restrict sPtr = static_cast<const uint8_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < inSize) && (ocount < (outSize - 3))); ++icount, ocount += 4)
{
@ -872,8 +872,8 @@ namespace
// D3DFMT_R3G3B2 -> DXGI_FORMAT_B5G6R5_UNORM
if (inSize >= 1 && outSize >= 2)
{
const uint8_t* __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
uint16_t * __restrict dPtr = reinterpret_cast<uint16_t*>(pDestination);
const uint8_t* __restrict sPtr = static_cast<const uint8_t*>(pSource);
uint16_t * __restrict dPtr = static_cast<uint16_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < inSize) && (ocount < (outSize - 1))); ++icount, ocount += 2)
{
@ -901,8 +901,8 @@ namespace
// D3DFMT_A8R3G3B2 -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 2 && outSize >= 4)
{
const uint16_t* __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint16_t* __restrict sPtr = static_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < (inSize - 1)) && (ocount < (outSize - 3))); icount += 2, ocount += 4)
{
@ -926,8 +926,8 @@ namespace
// D3DFMT_P8 -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 1 && outSize >= 4)
{
const uint8_t* __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint8_t* __restrict sPtr = static_cast<const uint8_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < inSize) && (ocount < (outSize - 3))); ++icount, ocount += 4)
{
@ -946,8 +946,8 @@ namespace
// D3DFMT_A8P8 -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 2 && outSize >= 4)
{
const uint16_t* __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint16_t* __restrict sPtr = static_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < (inSize - 1)) && (ocount < (outSize - 3))); icount += 2, ocount += 4)
{
@ -969,8 +969,8 @@ namespace
// D3DFMT_A4L4 -> DXGI_FORMAT_B4G4R4A4_UNORM
if (inSize >= 1 && outSize >= 2)
{
const uint8_t * __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
uint16_t * __restrict dPtr = reinterpret_cast<uint16_t*>(pDestination);
const uint8_t * __restrict sPtr = static_cast<const uint8_t*>(pSource);
uint16_t * __restrict dPtr = static_cast<uint16_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < inSize) && (ocount < (outSize - 1))); ++icount, ocount += 2)
{
@ -989,8 +989,8 @@ namespace
// D3DFMT_A4L4 -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 1 && outSize >= 4)
{
const uint8_t * __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint8_t * __restrict sPtr = static_cast<const uint8_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < inSize) && (ocount < (outSize - 3))); ++icount, ocount += 4)
{
@ -1017,8 +1017,8 @@ namespace
// D3DFMT_A4R4G4B4 -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 2 && outSize >= 4)
{
const uint16_t * __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint16_t * __restrict sPtr = static_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < (inSize - 1)) && (ocount < (outSize - 3))); icount += 2, ocount += 4)
{
@ -1042,8 +1042,8 @@ namespace
// D3DFMT_L8 -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 1 && outSize >= 4)
{
const uint8_t * __restrict sPtr = reinterpret_cast<const uint8_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint8_t * __restrict sPtr = static_cast<const uint8_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < inSize) && (ocount < (outSize - 3))); ++icount, ocount += 4)
{
@ -1064,8 +1064,8 @@ namespace
// D3DFMT_L16 -> DXGI_FORMAT_R16G16B16A16_UNORM
if (inSize >= 2 && outSize >= 8)
{
const uint16_t* __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
uint64_t * __restrict dPtr = reinterpret_cast<uint64_t*>(pDestination);
const uint16_t* __restrict sPtr = static_cast<const uint16_t*>(pSource);
uint64_t * __restrict dPtr = static_cast<uint64_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < (inSize - 1)) && (ocount < (outSize - 7))); icount += 2, ocount += 8)
{
@ -1088,8 +1088,8 @@ namespace
// D3DFMT_A8L8 -> DXGI_FORMAT_R8G8B8A8_UNORM
if (inSize >= 2 && outSize >= 4)
{
const uint16_t* __restrict sPtr = reinterpret_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = reinterpret_cast<uint32_t*>(pDestination);
const uint16_t* __restrict sPtr = static_cast<const uint16_t*>(pSource);
uint32_t * __restrict dPtr = static_cast<uint32_t*>(pDestination);
for (size_t ocount = 0, icount = 0; ((icount < (inSize - 1)) && (ocount < (outSize - 3))); icount += 2, ocount += 4)
{
@ -1198,7 +1198,7 @@ namespace
size_t dpitch = images[index].rowPitch;
size_t spitch = timages[index].rowPitch;
const uint8_t *pSrc = const_cast<const uint8_t*>(timages[index].pixels);
const uint8_t *pSrc = timages[index].pixels;
if (!pSrc)
return E_POINTER;
@ -1300,7 +1300,7 @@ namespace
size_t dpitch = images[index].rowPitch;
size_t spitch = timages[index].rowPitch;
const uint8_t *pSrc = const_cast<const uint8_t*>(timages[index].pixels);
const uint8_t *pSrc = timages[index].pixels;
if (!pSrc)
return E_POINTER;
@ -1492,7 +1492,7 @@ HRESULT DirectX::GetMetadataFromDDSFile(
// Read the header in (including extended header if present)
const size_t MAX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_DXT10);
uint8_t header[MAX_HEADER_SIZE];
uint8_t header[MAX_HEADER_SIZE] = {};
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, MAX_HEADER_SIZE, &bytesRead, nullptr))
@ -1536,7 +1536,7 @@ HRESULT DirectX::LoadFromDDSMemory(
const uint32_t *pal8 = nullptr;
if (convFlags & CONV_FLAGS_PAL8)
{
pal8 = reinterpret_cast<const uint32_t*>(reinterpret_cast<const uint8_t*>(pSource) + offset);
pal8 = reinterpret_cast<const uint32_t*>(static_cast<const uint8_t*>(pSource) + offset);
assert(pal8);
offset += (256 * sizeof(uint32_t));
if (size < offset)
@ -1557,7 +1557,7 @@ HRESULT DirectX::LoadFromDDSMemory(
cflags |= CP_FLAGS_BAD_DXTN_TAILS;
}
auto pPixels = reinterpret_cast<const void*>(reinterpret_cast<const uint8_t*>(pSource) + offset);
const void* pPixels = static_cast<const uint8_t*>(pSource) + offset;
assert(pPixels);
hr = CopyImage(pPixels,
size - offset,
@ -1626,7 +1626,7 @@ HRESULT DirectX::LoadFromDDSFile(
// Read the header in (including extended header if present)
const size_t MAX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_DXT10);
uint8_t header[MAX_HEADER_SIZE];
uint8_t header[MAX_HEADER_SIZE] = {};
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, MAX_HEADER_SIZE, &bytesRead, nullptr))
@ -1813,7 +1813,7 @@ HRESULT DirectX::SaveToDDSMemory(
if (FAILED(hr))
return hr;
auto pDestination = reinterpret_cast<uint8_t*>(blob.GetBufferPointer());
auto pDestination = static_cast<uint8_t*>(blob.GetBufferPointer());
assert(pDestination);
hr = _EncodeDDSHeader(metadata, flags, pDestination, blob.GetBufferSize(), required);
@ -1868,7 +1868,7 @@ HRESULT DirectX::SaveToDDSMemory(
size_t rowPitch = images[index].rowPitch;
const uint8_t * __restrict sPtr = images[index].pixels;
uint8_t * __restrict dPtr = reinterpret_cast<uint8_t*>(pDestination);
uint8_t * __restrict dPtr = pDestination;
size_t lines = ComputeScanlines(metadata.format, images[index].height);
size_t csize = std::min<size_t>(rowPitch, ddsRowPitch);
@ -1937,7 +1937,7 @@ HRESULT DirectX::SaveToDDSMemory(
size_t rowPitch = images[index].rowPitch;
const uint8_t * __restrict sPtr = images[index].pixels;
uint8_t * __restrict dPtr = reinterpret_cast<uint8_t*>(pDestination);
uint8_t * __restrict dPtr = pDestination;
size_t lines = ComputeScanlines(metadata.format, images[index].height);
size_t csize = std::min<size_t>(rowPitch, ddsRowPitch);

View File

@ -102,7 +102,7 @@ namespace
// Process first part of header
bool formatFound = false;
const char* info = reinterpret_cast<const char*>(pSource);
auto info = static_cast<const char*>(pSource);
while (size > 0)
{
if (*info == '\n')
@ -275,7 +275,7 @@ namespace
return E_FAIL;
}
offset = info - reinterpret_cast<const char*>(pSource);
offset = info - static_cast<const char*>(pSource);
metadata.width = width;
metadata.height = height;
@ -569,7 +569,7 @@ HRESULT DirectX::GetMetadataFromHDRFile(const wchar_t* szFile, TexMetadata& meta
}
// Read the first part of the file to find the header
uint8_t header[8192];
uint8_t header[8192] = {};
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, std::min<DWORD>(sizeof(header), fileInfo.EndOfFile.LowPart), &bytesRead, nullptr))
{
@ -612,7 +612,7 @@ HRESULT DirectX::LoadFromHDRMemory(const void* pSource, size_t size, TexMetadata
return hr;
// Copy pixels
auto sourcePtr = reinterpret_cast<const uint8_t*>(pSource) + offset;
auto sourcePtr = static_cast<const uint8_t*>(pSource) + offset;
size_t pixelLen = remaining;
@ -908,7 +908,7 @@ HRESULT DirectX::SaveToHDRMemory(const Image& image, Blob& blob)
return hr;
// Copy header
auto dPtr = reinterpret_cast<uint8_t*>(blob.GetBufferPointer());
auto dPtr = static_cast<uint8_t*>(blob.GetBufferPointer());
assert(dPtr != 0);
memcpy_s(dPtr, blob.GetBufferSize(), header, headerLen);
dPtr += headerLen;
@ -933,7 +933,7 @@ HRESULT DirectX::SaveToHDRMemory(const Image& image, Blob& blob)
auto rgbe = temp.get();
auto enc = temp.get() + rowPitch;
auto sPtr = reinterpret_cast<const uint8_t*>(image.pixels);
const uint8_t* sPtr = image.pixels;
for (size_t scan = 0; scan < image.height; ++scan)
{
FloatToRGBE(rgbe, reinterpret_cast<const float*>(sPtr), image.width, fpp);
@ -953,7 +953,7 @@ HRESULT DirectX::SaveToHDRMemory(const Image& image, Blob& blob)
}
#endif
hr = blob.Trim(dPtr - reinterpret_cast<uint8_t*>(blob.GetBufferPointer()));
hr = blob.Trim(dPtr - static_cast<uint8_t*>(blob.GetBufferPointer()));
if (FAILED(hr))
{
blob.Release();
@ -1079,7 +1079,7 @@ HRESULT DirectX::SaveToHDRFile(const Image& image, const wchar_t* szFile)
#else
auto enc = temp.get() + rowPitch;
auto sPtr = reinterpret_cast<const uint8_t*>(image.pixels);
const uint8_t* sPtr = image.pixels;
for (size_t scan = 0; scan < image.height; ++scan)
{
FloatToRGBE(rgbe, reinterpret_cast<const float*>(sPtr), image.width, fpp);

View File

@ -327,7 +327,7 @@ HRESULT ScratchImage::Initialize(const TexMetadata& mdata, DWORD flags)
m_nimages = nimages;
memset(m_image, 0, sizeof(Image) * nimages);
m_memory = reinterpret_cast<uint8_t*>(_aligned_malloc(pixelSize, 16));
m_memory = static_cast<uint8_t*>(_aligned_malloc(pixelSize, 16));
if (!m_memory)
{
Release();
@ -393,7 +393,7 @@ HRESULT ScratchImage::Initialize2D(DXGI_FORMAT fmt, size_t width, size_t height,
m_nimages = nimages;
memset(m_image, 0, sizeof(Image) * nimages);
m_memory = reinterpret_cast<uint8_t*>(_aligned_malloc(pixelSize, 16));
m_memory = static_cast<uint8_t*>(_aligned_malloc(pixelSize, 16));
if (!m_memory)
{
Release();
@ -445,7 +445,7 @@ HRESULT ScratchImage::Initialize3D(DXGI_FORMAT fmt, size_t width, size_t height,
m_nimages = nimages;
memset(m_image, 0, sizeof(Image) * nimages);
m_memory = reinterpret_cast<uint8_t*>(_aligned_malloc(pixelSize, 16));
m_memory = static_cast<uint8_t*>(_aligned_malloc(pixelSize, 16));
if (!m_memory)
{
Release();
@ -492,11 +492,11 @@ HRESULT ScratchImage::InitializeFromImage(const Image& srcImage, bool allow1D, D
if (!rowCount)
return E_UNEXPECTED;
const uint8_t* sptr = reinterpret_cast<const uint8_t*>(srcImage.pixels);
const uint8_t* sptr = srcImage.pixels;
if (!sptr)
return E_POINTER;
auto dptr = reinterpret_cast<uint8_t*>(m_image[0].pixels);
uint8_t* dptr = m_image[0].pixels;
if (!dptr)
return E_POINTER;
@ -550,12 +550,12 @@ HRESULT ScratchImage::InitializeArrayFromImages(const Image* images, size_t nIma
for (size_t index = 0; index < nImages; ++index)
{
auto sptr = reinterpret_cast<const uint8_t*>(images[index].pixels);
const uint8_t* sptr = images[index].pixels;
if (!sptr)
return E_POINTER;
assert(index < m_nimages);
auto dptr = reinterpret_cast<uint8_t*>(m_image[index].pixels);
uint8_t* dptr = m_image[index].pixels;
if (!dptr)
return E_POINTER;
@ -626,12 +626,12 @@ HRESULT ScratchImage::Initialize3DFromImages(const Image* images, size_t depth,
for (size_t slice = 0; slice < depth; ++slice)
{
auto sptr = reinterpret_cast<const uint8_t*>(images[slice].pixels);
const uint8_t* sptr = images[slice].pixels;
if (!sptr)
return E_POINTER;
assert(slice < m_nimages);
auto dptr = reinterpret_cast<uint8_t*>(m_image[slice].pixels);
uint8_t* dptr = m_image[slice].pixels;
if (!dptr)
return E_POINTER;
@ -760,7 +760,7 @@ bool ScratchImage::IsAlphaAllOpaque() const
}
else
{
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*m_metadata.width), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*m_metadata.width), 16)));
if (!scanline)
return false;

View File

@ -654,7 +654,7 @@ namespace
size_t height = mipChain.GetMetadata().height;
// Allocate temporary space (2 scanlines)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 2), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 2), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -741,7 +741,7 @@ namespace
return E_FAIL;
// Allocate temporary space (3 scanlines)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 3), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 3), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -832,7 +832,7 @@ namespace
size_t height = mipChain.GetMetadata().height;
// Allocate temporary space (3 scanlines, plus X and Y filters)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 3), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 3), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -943,7 +943,7 @@ namespace
size_t height = mipChain.GetMetadata().height;
// Allocate temporary space (5 scanlines, plus X and Y filters)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 5), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 5), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -1131,7 +1131,7 @@ namespace
size_t height = mipChain.GetMetadata().height;
// Allocate initial temporary space (1 scanline, accumulation rows, plus X and Y filters)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR) * width, 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR) * width, 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -1220,7 +1220,7 @@ namespace
}
else
{
rowAcc->scanline.reset(reinterpret_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR) * nwidth, 16)));
rowAcc->scanline.reset(static_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR) * nwidth, 16)));
if (!rowAcc->scanline)
return E_OUTOFMEMORY;
}
@ -1399,7 +1399,7 @@ namespace
size_t height = mipChain.GetMetadata().height;
// Allocate temporary space (2 scanlines)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 2), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 2), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -1548,7 +1548,7 @@ namespace
return E_FAIL;
// Allocate temporary space (5 scanlines)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 5), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 5), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -1717,7 +1717,7 @@ namespace
size_t height = mipChain.GetMetadata().height;
// Allocate temporary space (5 scanlines, plus X/Y/Z filters)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 5), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 5), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -1910,7 +1910,7 @@ namespace
size_t height = mipChain.GetMetadata().height;
// Allocate temporary space (17 scanlines, plus X/Y/Z filters)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 17), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 17), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -2291,7 +2291,7 @@ namespace
size_t height = mipChain.GetMetadata().height;
// Allocate initial temporary space (1 scanline, accumulation rows, plus X/Y/Z filters)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR) * width, 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR) * width, 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -2375,7 +2375,7 @@ namespace
else
{
size_t bytes = sizeof(XMVECTOR) * nwidth * nheight;
sliceAcc->scanline.reset(reinterpret_cast<XMVECTOR*>(_aligned_malloc(bytes, 16)));
sliceAcc->scanline.reset(static_cast<XMVECTOR*>(_aligned_malloc(bytes, 16)));
if (!sliceAcc->scanline)
return E_OUTOFMEMORY;
}
@ -2551,7 +2551,7 @@ HRESULT DirectX::GenerateMipMaps(
return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
}
HRESULT hr;
HRESULT hr = E_UNEXPECTED;
static_assert(TEX_FILTER_POINT == 0x100000, "TEX_FILTER_ flag values don't match TEX_FILTER_MASK");
@ -2744,7 +2744,7 @@ HRESULT DirectX::GenerateMipMaps(
assert(baseImages.size() == metadata.arraySize);
HRESULT hr;
HRESULT hr = E_UNEXPECTED;
static_assert(TEX_FILTER_POINT == 0x100000, "TEX_FILTER_ flag values don't match TEX_FILTER_MASK");
@ -2952,7 +2952,7 @@ HRESULT DirectX::GenerateMipMaps3D(
static_assert(TEX_FILTER_POINT == 0x100000, "TEX_FILTER_ flag values don't match TEX_FILTER_MASK");
HRESULT hr;
HRESULT hr = E_UNEXPECTED;
DWORD filter_select = (filter & TEX_FILTER_MASK);
if (!filter_select)
@ -3066,7 +3066,7 @@ HRESULT DirectX::GenerateMipMaps3D(
assert(baseImages.size() == metadata.depth);
HRESULT hr;
HRESULT hr = E_UNEXPECTED;
static_assert(TEX_FILTER_POINT == 0x100000, "TEX_FILTER_ flag values don't match TEX_FILTER_MASK");

View File

@ -33,7 +33,7 @@ namespace
const size_t width = image1.width;
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width) * 2, 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width) * 2, 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -184,7 +184,7 @@ namespace
const size_t width = image.width;
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -222,7 +222,7 @@ namespace
const size_t width = srcImage.width;
ScopedAlignedArrayXMVECTOR scanlines(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width*2), 16)));
ScopedAlignedArrayXMVECTOR scanlines(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width*2), 16)));
if (!scanlines)
return E_OUTOFMEMORY;
@ -347,7 +347,7 @@ HRESULT DirectX::CopyRectangle(
uint8_t* pDest = dstImage.pixels + (yOffset * dstImage.rowPitch) + (xOffset * dbpp);
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*srcRect.w), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*srcRect.w), 16)));
if (!scanline)
return E_OUTOFMEMORY;

View File

@ -93,11 +93,11 @@ namespace
return E_FAIL;
// Allocate temporary space (4 scanlines and 3 evaluated rows)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 4), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*width * 4), 16)));
if (!scanline)
return E_OUTOFMEMORY;
ScopedAlignedArrayFloat buffer(reinterpret_cast<float*>(_aligned_malloc(((sizeof(float) * (width + 2)) * 3), 16)));
ScopedAlignedArrayFloat buffer(static_cast<float*>(_aligned_malloc(((sizeof(float) * (width + 2)) * 3), 16)));
if (!buffer)
return E_OUTOFMEMORY;

View File

@ -22,7 +22,7 @@ namespace
assert(srcImage.width == destImage.width);
assert(srcImage.height == destImage.height);
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*srcImage.width), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*srcImage.width), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -65,7 +65,7 @@ namespace
static_assert(static_cast<int>(TEX_PMALPHA_SRGB) == static_cast<int>(TEX_FILTER_SRGB), "TEX_PMALHPA_SRGB* should match TEX_FILTER_SRGB*");
flags &= TEX_PMALPHA_SRGB;
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*srcImage.width), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*srcImage.width), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -105,7 +105,7 @@ namespace
assert(srcImage.width == destImage.width);
assert(srcImage.height == destImage.height);
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*srcImage.width), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*srcImage.width), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -148,7 +148,7 @@ namespace
static_assert(static_cast<int>(TEX_PMALPHA_SRGB) == static_cast<int>(TEX_FILTER_SRGB), "TEX_PMALHPA_SRGB* should match TEX_FILTER_SRGB*");
flags &= TEX_PMALPHA_SRGB;
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*srcImage.width), 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc((sizeof(XMVECTOR)*srcImage.width), 16)));
if (!scanline)
return E_OUTOFMEMORY;

View File

@ -247,7 +247,7 @@ namespace
assert(srcImage.format == destImage.format);
// Allocate temporary space (2 scanlines)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc(
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc(
(sizeof(XMVECTOR) * (srcImage.width + destImage.width)), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -308,7 +308,7 @@ namespace
return E_FAIL;
// Allocate temporary space (3 scanlines)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc(
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc(
(sizeof(XMVECTOR) * (srcImage.width * 2 + destImage.width)), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -367,7 +367,7 @@ namespace
assert(srcImage.format == destImage.format);
// Allocate temporary space (3 scanlines, plus X and Y filters)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc(
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc(
(sizeof(XMVECTOR) * (srcImage.width * 2 + destImage.width)), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -453,7 +453,7 @@ namespace
assert(srcImage.format == destImage.format);
// Allocate temporary space (5 scanlines, plus X and Y filters)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc(
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc(
(sizeof(XMVECTOR) * (srcImage.width * 4 + destImage.width)), 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -615,7 +615,7 @@ namespace
using namespace TriangleFilter;
// Allocate initial temporary space (1 scanline, accumulation rows, plus X and Y filters)
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR) * srcImage.width, 16)));
ScopedAlignedArrayXMVECTOR scanline(static_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR) * srcImage.width, 16)));
if (!scanline)
return E_OUTOFMEMORY;
@ -684,7 +684,7 @@ namespace
}
else
{
rowAcc->scanline.reset(reinterpret_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR) * destImage.width, 16)));
rowAcc->scanline.reset(static_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR) * destImage.width, 16)));
if (!rowAcc->scanline)
return E_OUTOFMEMORY;
}

View File

@ -131,7 +131,7 @@ namespace
return HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
}
auto pHeader = reinterpret_cast<const TGA_HEADER*>(pSource);
auto pHeader = static_cast<const TGA_HEADER*>(pSource);
if (pHeader->bColorMapType != 0
|| pHeader->wColorMapLength != 0)
@ -237,7 +237,7 @@ namespace
{
assert(image);
auto pPixels = reinterpret_cast<uint8_t*>(image->pixels);
uint8_t* pPixels = image->pixels;
if (!pPixels)
return E_POINTER;
@ -277,7 +277,7 @@ namespace
ComputePitch(image->format, image->width, image->height, rowPitch, slicePitch, CP_FLAGS_NONE);
}
auto sPtr = reinterpret_cast<const uint8_t*>(pSource);
auto sPtr = static_cast<const uint8_t*>(pSource);
const uint8_t* endPtr = sPtr + size;
switch (image->format)
@ -289,7 +289,7 @@ namespace
size_t offset = ((convFlags & CONV_FLAGS_INVERTX) ? (image->width - 1) : 0);
assert(offset < rowPitch);
uint8_t* dPtr = reinterpret_cast<uint8_t*>(image->pixels)
uint8_t* dPtr = image->pixels
+ (image->rowPitch * ((convFlags & CONV_FLAGS_INVERTY) ? y : (image->height - y - 1)))
+ offset;
@ -355,7 +355,7 @@ namespace
size_t offset = ((convFlags & CONV_FLAGS_INVERTX) ? (image->width - 1) : 0);
assert(offset * 2 < rowPitch);
uint16_t* dPtr = reinterpret_cast<uint16_t*>(reinterpret_cast<uint8_t*>(image->pixels)
auto dPtr = reinterpret_cast<uint16_t*>(image->pixels
+ (image->rowPitch * ((convFlags & CONV_FLAGS_INVERTY) ? y : (image->height - y - 1))))
+ offset;
@ -438,7 +438,7 @@ namespace
{
size_t offset = ((convFlags & CONV_FLAGS_INVERTX) ? (image->width - 1) : 0);
uint32_t* dPtr = reinterpret_cast<uint32_t*>(reinterpret_cast<uint8_t*>(image->pixels)
auto dPtr = reinterpret_cast<uint32_t*>(image->pixels
+ (image->rowPitch * ((convFlags & CONV_FLAGS_INVERTY) ? y : (image->height - y - 1))))
+ offset;
@ -601,7 +601,7 @@ namespace
ComputePitch(image->format, image->width, image->height, rowPitch, slicePitch, CP_FLAGS_NONE);
}
const uint8_t* sPtr = reinterpret_cast<const uint8_t*>(pSource);
auto sPtr = static_cast<const uint8_t*>(pSource);
const uint8_t* endPtr = sPtr + size;
switch (image->format)
@ -613,7 +613,7 @@ namespace
size_t offset = ((convFlags & CONV_FLAGS_INVERTX) ? (image->width - 1) : 0);
assert(offset < rowPitch);
uint8_t* dPtr = reinterpret_cast<uint8_t*>(image->pixels)
uint8_t* dPtr = image->pixels
+ (image->rowPitch * ((convFlags & CONV_FLAGS_INVERTY) ? y : (image->height - y - 1)))
+ offset;
@ -641,7 +641,7 @@ namespace
size_t offset = ((convFlags & CONV_FLAGS_INVERTX) ? (image->width - 1) : 0);
assert(offset * 2 < rowPitch);
uint16_t* dPtr = reinterpret_cast<uint16_t*>(reinterpret_cast<uint8_t*>(image->pixels)
auto dPtr = reinterpret_cast<uint16_t*>(image->pixels
+ (image->rowPitch * ((convFlags & CONV_FLAGS_INVERTY) ? y : (image->height - y - 1))))
+ offset;
@ -682,7 +682,7 @@ namespace
{
size_t offset = ((convFlags & CONV_FLAGS_INVERTX) ? (image->width - 1) : 0);
uint32_t* dPtr = reinterpret_cast<uint32_t*>(reinterpret_cast<uint8_t*>(image->pixels)
auto dPtr = reinterpret_cast<uint32_t*>(image->pixels
+ (image->rowPitch * ((convFlags & CONV_FLAGS_INVERTY) ? y : (image->height - y - 1))))
+ offset;
@ -820,8 +820,8 @@ namespace
assert(pDestination != pSource);
const uint32_t * __restrict sPtr = reinterpret_cast<const uint32_t*>(pSource);
uint8_t * __restrict dPtr = reinterpret_cast<uint8_t*>(pDestination);
const uint32_t * __restrict sPtr = static_cast<const uint32_t*>(pSource);
uint8_t * __restrict dPtr = static_cast<uint8_t*>(pDestination);
if (inSize >= 4 && outSize >= 3)
{
@ -900,7 +900,7 @@ HRESULT DirectX::GetMetadataFromTGAFile(const wchar_t* szFile, TexMetadata& meta
}
// Read the standard header (we don't need the file footer to parse the file)
uint8_t header[sizeof(TGA_HEADER)];
uint8_t header[sizeof(TGA_HEADER)] = {};
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, sizeof(TGA_HEADER), &bytesRead, nullptr))
{
@ -937,7 +937,7 @@ HRESULT DirectX::LoadFromTGAMemory(
if (offset > size)
return E_FAIL;
auto pPixels = reinterpret_cast<const void*>(reinterpret_cast<const uint8_t*>(pSource) + offset);
const void* pPixels = static_cast<const uint8_t*>(pSource) + offset;
size_t remaining = size - offset;
if (remaining == 0)
@ -1014,7 +1014,7 @@ HRESULT DirectX::LoadFromTGAFile(
}
// Read the header
uint8_t header[sizeof(TGA_HEADER)];
uint8_t header[sizeof(TGA_HEADER)] = {};
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, sizeof(TGA_HEADER), &bytesRead, nullptr))
{
@ -1238,7 +1238,7 @@ HRESULT DirectX::SaveToTGAMemory(const Image& image, Blob& blob)
if (!image.pixels)
return E_POINTER;
TGA_HEADER tga_header;
TGA_HEADER tga_header = {};
DWORD convFlags = 0;
HRESULT hr = EncodeTGAHeader(image, tga_header, convFlags);
if (FAILED(hr))
@ -1263,12 +1263,12 @@ HRESULT DirectX::SaveToTGAMemory(const Image& image, Blob& blob)
return hr;
// Copy header
auto dPtr = reinterpret_cast<uint8_t*>(blob.GetBufferPointer());
auto dPtr = static_cast<uint8_t*>(blob.GetBufferPointer());
assert(dPtr != 0);
memcpy_s(dPtr, blob.GetBufferSize(), &tga_header, sizeof(TGA_HEADER));
dPtr += sizeof(TGA_HEADER);
auto pPixels = reinterpret_cast<const uint8_t*>(image.pixels);
const uint8_t* pPixels = image.pixels;
assert(pPixels);
for (size_t y = 0; y < image.height; ++y)
@ -1307,7 +1307,7 @@ HRESULT DirectX::SaveToTGAFile(const Image& image, const wchar_t* szFile)
if (!image.pixels)
return E_POINTER;
TGA_HEADER tga_header;
TGA_HEADER tga_header = {};
DWORD convFlags = 0;
HRESULT hr = EncodeTGAHeader(image, tga_header, convFlags);
if (FAILED(hr))
@ -1378,7 +1378,7 @@ HRESULT DirectX::SaveToTGAFile(const Image& image, const wchar_t* szFile)
return E_FAIL;
// Write pixels
auto pPixels = reinterpret_cast<const uint8_t*>(image.pixels);
const uint8_t* pPixels = image.pixels;
for (size_t y = 0; y < image.height; ++y)
{

View File

@ -928,7 +928,7 @@ HRESULT DirectX::GetMetadataFromWICMemory(
if (FAILED(hr))
return hr;
hr = stream->InitializeFromMemory(reinterpret_cast<BYTE*>(const_cast<void*>(pSource)),
hr = stream->InitializeFromMemory(static_cast<BYTE*>(const_cast<void*>(pSource)),
static_cast<UINT>(size));
if (FAILED(hr))
return hr;
@ -1022,7 +1022,7 @@ HRESULT DirectX::LoadFromWICMemory(
if (FAILED(hr))
return hr;
hr = stream->InitializeFromMemory(reinterpret_cast<uint8_t*>(const_cast<void*>(pSource)), static_cast<DWORD>(size));
hr = stream->InitializeFromMemory(static_cast<uint8_t*>(const_cast<void*>(pSource)), static_cast<DWORD>(size));
if (FAILED(hr))
return hr;