mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-21 12:00:06 +00:00
permissive- code cleanup
This commit is contained in:
parent
b47a7d13d9
commit
8fcd276eba
@ -367,7 +367,7 @@ namespace DirectX
|
||||
}
|
||||
}
|
||||
|
||||
LDRColorA LDRColorA::operator = (_In_ const HDRColorA& c)
|
||||
LDRColorA operator = (_In_ const HDRColorA& c)
|
||||
{
|
||||
LDRColorA ret;
|
||||
HDRColorA tmp(c);
|
||||
|
@ -574,7 +574,7 @@ namespace
|
||||
bool sRGB = IsSRGB(format);
|
||||
|
||||
value.vt = VT_LPSTR;
|
||||
value.pszVal = "DirectXTex";
|
||||
value.pszVal = const_cast<char*>("DirectXTex");
|
||||
|
||||
if (memcmp(&containerFormat, &GUID_ContainerFormatPng, sizeof(GUID)) == 0)
|
||||
{
|
||||
@ -781,7 +781,7 @@ namespace
|
||||
{
|
||||
// Opt-in to the WIC2 support for writing 32-bit Windows BMP files with an alpha channel
|
||||
PROPBAG2 option = { 0 };
|
||||
option.pstrName = L"EnableV5Header32bppBGRA";
|
||||
option.pstrName = const_cast<wchar_t*>(L"EnableV5Header32bppBGRA");
|
||||
|
||||
VARIANT varValue;
|
||||
varValue.vt = VT_BOOL;
|
||||
|
@ -211,7 +211,7 @@ namespace
|
||||
{
|
||||
if (m_handle)
|
||||
{
|
||||
FILE_DISPOSITION_INFO info = {0};
|
||||
FILE_DISPOSITION_INFO info = {};
|
||||
info.DeleteFile = TRUE;
|
||||
(void)SetFileInformationByHandle(m_handle, FileDispositionInfo, &info, sizeof(info));
|
||||
}
|
||||
@ -602,8 +602,8 @@ namespace
|
||||
HRESULT CaptureTexture(
|
||||
_In_ ID3D11DeviceContext* pContext,
|
||||
_In_ ID3D11Resource* pSource,
|
||||
_Inout_ D3D11_TEXTURE2D_DESC& desc,
|
||||
_Inout_ ComPtr<ID3D11Texture2D>& pStaging )
|
||||
D3D11_TEXTURE2D_DESC& desc,
|
||||
ComPtr<ID3D11Texture2D>& pStaging )
|
||||
{
|
||||
if ( !pContext || !pSource )
|
||||
return E_INVALIDARG;
|
||||
@ -615,7 +615,7 @@ namespace
|
||||
return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
|
||||
|
||||
ComPtr<ID3D11Texture2D> pTexture;
|
||||
HRESULT hr = pSource->QueryInterface( IID_PPV_ARGS( pTexture.GetAddressOf() ) );
|
||||
HRESULT hr = pSource->QueryInterface(IID_PPV_ARGS(pTexture.GetAddressOf()));
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
|
||||
@ -663,7 +663,7 @@ namespace
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||
desc.Usage = D3D11_USAGE_STAGING;
|
||||
|
||||
hr = d3dDevice->CreateTexture2D( &desc, 0, pStaging.GetAddressOf() );
|
||||
hr = d3dDevice->CreateTexture2D(&desc, 0, pStaging.ReleaseAndGetAddressOf());
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
|
||||
@ -684,7 +684,7 @@ namespace
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||
desc.Usage = D3D11_USAGE_STAGING;
|
||||
|
||||
hr = d3dDevice->CreateTexture2D( &desc, 0, pStaging.GetAddressOf() );
|
||||
hr = d3dDevice->CreateTexture2D(&desc, 0, pStaging.ReleaseAndGetAddressOf());
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
|
||||
@ -756,7 +756,7 @@ HRESULT DirectX::SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
if ( !fileName )
|
||||
return E_INVALIDARG;
|
||||
|
||||
D3D11_TEXTURE2D_DESC desc = { 0 };
|
||||
D3D11_TEXTURE2D_DESC desc = {};
|
||||
ComPtr<ID3D11Texture2D> pStaging;
|
||||
HRESULT hr = CaptureTexture( pContext, pSource, desc, pStaging );
|
||||
if ( FAILED(hr) )
|
||||
@ -891,13 +891,13 @@ HRESULT DirectX::SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
|
||||
// Write header & pixels
|
||||
DWORD bytesWritten;
|
||||
if ( !WriteFile( hFile.get(), fileHeader, static_cast<DWORD>( headerSize ), &bytesWritten, 0 ) )
|
||||
if ( !WriteFile( hFile.get(), fileHeader, static_cast<DWORD>( headerSize ), &bytesWritten, nullptr ) )
|
||||
return HRESULT_FROM_WIN32( GetLastError() );
|
||||
|
||||
if ( bytesWritten != headerSize )
|
||||
return E_FAIL;
|
||||
|
||||
if ( !WriteFile( hFile.get(), pixels.get(), static_cast<DWORD>( slicePitch ), &bytesWritten, 0 ) )
|
||||
if ( !WriteFile( hFile.get(), pixels.get(), static_cast<DWORD>( slicePitch ), &bytesWritten, nullptr ) )
|
||||
return HRESULT_FROM_WIN32( GetLastError() );
|
||||
|
||||
if ( bytesWritten != slicePitch )
|
||||
@ -919,7 +919,7 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
if ( !fileName )
|
||||
return E_INVALIDARG;
|
||||
|
||||
D3D11_TEXTURE2D_DESC desc = { 0 };
|
||||
D3D11_TEXTURE2D_DESC desc = {};
|
||||
ComPtr<ID3D11Texture2D> pStaging;
|
||||
HRESULT hr = CaptureTexture( pContext, pSource, desc, pStaging );
|
||||
if ( FAILED(hr) )
|
||||
@ -974,7 +974,7 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
IWICImagingFactory* pWIC = _GetWIC();
|
||||
auto pWIC = _GetWIC();
|
||||
if ( !pWIC )
|
||||
return E_NOINTERFACE;
|
||||
|
||||
@ -1007,8 +1007,8 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
if ( targetFormat && memcmp( &guidContainerFormat, &GUID_ContainerFormatBmp, sizeof(WICPixelFormatGUID) ) == 0 && g_WIC2 )
|
||||
{
|
||||
// Opt-in to the WIC2 support for writing 32-bit Windows BMP files with an alpha channel
|
||||
PROPBAG2 option = { 0 };
|
||||
option.pstrName = L"EnableV5Header32bppBGRA";
|
||||
PROPBAG2 option = {};
|
||||
option.pstrName = const_cast<wchar_t*>(L"EnableV5Header32bppBGRA");
|
||||
|
||||
VARIANT varValue;
|
||||
varValue.vt = VT_BOOL;
|
||||
@ -1094,7 +1094,7 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
PropVariantInit( &value );
|
||||
|
||||
value.vt = VT_LPSTR;
|
||||
value.pszVal = "DirectXTK";
|
||||
value.pszVal = const_cast<char*>("DirectXTK");
|
||||
|
||||
if ( memcmp( &guidContainerFormat, &GUID_ContainerFormatPng, sizeof(GUID) ) == 0 )
|
||||
{
|
||||
|
@ -738,7 +738,7 @@ namespace
|
||||
&bufferDesc,
|
||||
D3D12_RESOURCE_STATE_COPY_DEST,
|
||||
nullptr,
|
||||
IID_PPV_ARGS(pStaging.GetAddressOf()));
|
||||
IID_PPV_ARGS(pStaging.ReleaseAndGetAddressOf()));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
@ -1113,7 +1113,7 @@ HRESULT DirectX::SaveWICTextureToFile( ID3D12CommandQueue* pCommandQ,
|
||||
{
|
||||
// Opt-in to the WIC2 support for writing 32-bit Windows BMP files with an alpha channel
|
||||
PROPBAG2 option = {};
|
||||
option.pstrName = L"EnableV5Header32bppBGRA";
|
||||
option.pstrName = const_cast<wchar_t*>(L"EnableV5Header32bppBGRA");
|
||||
|
||||
VARIANT varValue;
|
||||
varValue.vt = VT_BOOL;
|
||||
@ -1190,7 +1190,7 @@ HRESULT DirectX::SaveWICTextureToFile( ID3D12CommandQueue* pCommandQ,
|
||||
PropVariantInit( &value );
|
||||
|
||||
value.vt = VT_LPSTR;
|
||||
value.pszVal = "DirectXTK";
|
||||
value.pszVal = const_cast<char*>("DirectXTK");
|
||||
|
||||
if ( memcmp( &guidContainerFormat, &GUID_ContainerFormatPng, sizeof(GUID) ) == 0 )
|
||||
{
|
||||
|
@ -2334,7 +2334,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
{
|
||||
PROPBAG2 options = {};
|
||||
VARIANT varValues = {};
|
||||
options.pstrName = L"ImageQuality";
|
||||
options.pstrName = const_cast<wchar_t*>(L"ImageQuality");
|
||||
varValues.vt = VT_R4;
|
||||
varValues.fltVal = (wicLossless) ? 1.f : wicQuality;
|
||||
(void)props->Write(1, &options, &varValues);
|
||||
@ -2347,13 +2347,13 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
VARIANT varValues = {};
|
||||
if (wicLossless)
|
||||
{
|
||||
options.pstrName = L"TiffCompressionMethod";
|
||||
options.pstrName = const_cast<wchar_t*>(L"TiffCompressionMethod");
|
||||
varValues.vt = VT_UI1;
|
||||
varValues.bVal = WICTiffCompressionNone;
|
||||
}
|
||||
else if (wicQuality >= 0.f)
|
||||
{
|
||||
options.pstrName = L"CompressionQuality";
|
||||
options.pstrName = const_cast<wchar_t*>(L"CompressionQuality");
|
||||
varValues.vt = VT_R4;
|
||||
varValues.fltVal = wicQuality;
|
||||
}
|
||||
@ -2369,13 +2369,13 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
VARIANT varValues = {};
|
||||
if (wicLossless)
|
||||
{
|
||||
options.pstrName = L"Lossless";
|
||||
options.pstrName = const_cast<wchar_t*>(L"Lossless");
|
||||
varValues.vt = VT_BOOL;
|
||||
varValues.bVal = TRUE;
|
||||
}
|
||||
else if (wicQuality >= 0.f)
|
||||
{
|
||||
options.pstrName = L"ImageQuality";
|
||||
options.pstrName = const_cast<wchar_t*>(L"ImageQuality");
|
||||
varValues.vt = VT_R4;
|
||||
varValues.fltVal = wicQuality;
|
||||
}
|
||||
|
@ -888,7 +888,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx(ID3D11Device* d3dDevice,
|
||||
{
|
||||
if (texture != 0 || textureView != 0)
|
||||
{
|
||||
CHAR strFileA[MAX_PATH];
|
||||
char strFileA[MAX_PATH];
|
||||
int result = WideCharToMultiByte(CP_ACP,
|
||||
WC_NO_BEST_FIT_CHARS,
|
||||
fileName,
|
||||
@ -900,7 +900,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx(ID3D11Device* d3dDevice,
|
||||
);
|
||||
if (result > 0)
|
||||
{
|
||||
const CHAR* pstrName = strrchr(strFileA, '\\');
|
||||
const char* pstrName = strrchr(strFileA, '\\');
|
||||
if (!pstrName)
|
||||
{
|
||||
pstrName = strFileA;
|
||||
|
Loading…
Reference in New Issue
Block a user