1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 20:10:05 +00:00

Minor code review feedback

This commit is contained in:
Chuck Walbourn 2018-06-11 12:22:52 -07:00
parent 2ef59eb99c
commit 094988727e
10 changed files with 46 additions and 46 deletions

View File

@ -4457,7 +4457,7 @@ namespace
if (FAILED(hr))
return hr;
hr = FC->CopyPixels(0, static_cast<UINT>(destImage.rowPitch), static_cast<UINT>(destImage.slicePitch), destImage.pixels);
hr = FC->CopyPixels(nullptr, static_cast<UINT>(destImage.rowPitch), static_cast<UINT>(destImage.slicePitch), destImage.pixels);
if (FAILED(hr))
return hr;

View File

@ -70,7 +70,7 @@ namespace
if (destImage.width != nwidth || destImage.height != nheight)
return E_FAIL;
hr = FR->CopyPixels(0, static_cast<UINT>(destImage.rowPitch), static_cast<UINT>(destImage.slicePitch), destImage.pixels);
hr = FR->CopyPixels(nullptr, static_cast<UINT>(destImage.rowPitch), static_cast<UINT>(destImage.slicePitch), destImage.pixels);
if (FAILED(hr))
return hr;

View File

@ -547,7 +547,7 @@ namespace
if (memcmp(&pfScaler, &pfGUID, sizeof(WICPixelFormatGUID)) == 0)
{
hr = scaler->CopyPixels(0, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
hr = scaler->CopyPixels(nullptr, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
if (FAILED(hr))
return hr;
}
@ -571,7 +571,7 @@ namespace
if (FAILED(hr))
return hr;
hr = FC->CopyPixels(0, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
hr = FC->CopyPixels(nullptr, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
if (FAILED(hr))
return hr;
}

View File

@ -87,7 +87,7 @@ namespace
if (memcmp(&pfScaler, &pfGUID, sizeof(WICPixelFormatGUID)) == 0)
{
hr = scaler->CopyPixels(0, static_cast<UINT>(destImage.rowPitch), static_cast<UINT>(destImage.slicePitch), destImage.pixels);
hr = scaler->CopyPixels(nullptr, static_cast<UINT>(destImage.rowPitch), static_cast<UINT>(destImage.slicePitch), destImage.pixels);
if (FAILED(hr))
return hr;
}
@ -111,7 +111,7 @@ namespace
if (FAILED(hr))
return hr;
hr = FC->CopyPixels(0, static_cast<UINT>(destImage.rowPitch), static_cast<UINT>(destImage.slicePitch), destImage.pixels);
hr = FC->CopyPixels(nullptr, static_cast<UINT>(destImage.rowPitch), static_cast<UINT>(destImage.slicePitch), destImage.pixels);
if (FAILED(hr))
return hr;
}

View File

@ -392,7 +392,7 @@ namespace
if (memcmp(&convertGUID, &GUID_NULL, sizeof(GUID)) == 0)
{
hr = frame->CopyPixels(0, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
hr = frame->CopyPixels(nullptr, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
if (FAILED(hr))
return hr;
}
@ -419,7 +419,7 @@ namespace
if (FAILED(hr))
return hr;
hr = FC->CopyPixels(0, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
hr = FC->CopyPixels(nullptr, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
if (FAILED(hr))
return hr;
}
@ -479,7 +479,7 @@ namespace
// This frame does not need resized
if (memcmp(&pfGuid, &sourceGUID, sizeof(WICPixelFormatGUID)) == 0)
{
hr = frame->CopyPixels(0, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
hr = frame->CopyPixels(nullptr, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
if (FAILED(hr))
return hr;
}
@ -501,7 +501,7 @@ namespace
if (FAILED(hr))
return hr;
hr = FC->CopyPixels(0, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
hr = FC->CopyPixels(nullptr, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
if (FAILED(hr))
return hr;
}
@ -525,7 +525,7 @@ namespace
if (memcmp(&pfScaler, &sourceGUID, sizeof(WICPixelFormatGUID)) == 0)
{
hr = scaler->CopyPixels(0, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
hr = scaler->CopyPixels(nullptr, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
if (FAILED(hr))
return hr;
}
@ -549,7 +549,7 @@ namespace
if (FAILED(hr))
return hr;
hr = FC->CopyPixels(0, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
hr = FC->CopyPixels(nullptr, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
if (FAILED(hr))
return hr;
}
@ -780,7 +780,7 @@ namespace
return E_NOINTERFACE;
ComPtr<IWICBitmapEncoder> encoder;
HRESULT hr = pWIC->CreateEncoder(containerFormat, 0, encoder.GetAddressOf());
HRESULT hr = pWIC->CreateEncoder(containerFormat, nullptr, encoder.GetAddressOf());
if (FAILED(hr))
return hr;
@ -848,7 +848,7 @@ namespace
return E_NOINTERFACE;
ComPtr<IWICBitmapEncoder> encoder;
HRESULT hr = pWIC->CreateEncoder(containerFormat, 0, encoder.GetAddressOf());
HRESULT hr = pWIC->CreateEncoder(containerFormat, nullptr, encoder.GetAddressOf());
if (FAILED(hr))
return hr;
@ -935,7 +935,7 @@ HRESULT DirectX::GetMetadataFromWICMemory(
// Initialize WIC
ComPtr<IWICBitmapDecoder> decoder;
hr = pWIC->CreateDecoderFromStream(stream.Get(), 0, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
hr = pWIC->CreateDecoderFromStream(stream.Get(), nullptr, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
if (FAILED(hr))
return hr;
@ -973,7 +973,7 @@ HRESULT DirectX::GetMetadataFromWICFile(
// Initialize WIC
ComPtr<IWICBitmapDecoder> decoder;
HRESULT hr = pWIC->CreateDecoderFromFilename(szFile, 0, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
HRESULT hr = pWIC->CreateDecoderFromFilename(szFile, nullptr, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
if (FAILED(hr))
return hr;
@ -1028,7 +1028,7 @@ HRESULT DirectX::LoadFromWICMemory(
// Initialize WIC
ComPtr<IWICBitmapDecoder> decoder;
hr = pWIC->CreateDecoderFromStream(stream.Get(), 0, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
hr = pWIC->CreateDecoderFromStream(stream.Get(), nullptr, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
if (FAILED(hr))
return hr;
@ -1089,7 +1089,7 @@ HRESULT DirectX::LoadFromWICFile(
// Initialize WIC
ComPtr<IWICBitmapDecoder> decoder;
HRESULT hr = pWIC->CreateDecoderFromFilename(szFile, 0, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
HRESULT hr = pWIC->CreateDecoderFromFilename(szFile, nullptr, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
if (FAILED(hr))
return hr;

View File

@ -701,7 +701,7 @@ namespace
IWICImagingFactory* factory = nullptr;
InitOnceExecuteOnce(&s_initOnce,
[](PINIT_ONCE, PVOID, LPVOID *factory) -> BOOL
[](PINIT_ONCE, PVOID, LPVOID *ifactory) -> BOOL
{
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE)
HRESULT hr = CoCreateInstance(
@ -709,7 +709,7 @@ namespace
nullptr,
CLSCTX_INPROC_SERVER,
__uuidof(IWICImagingFactory2),
factory
ifactory
);
if ( SUCCEEDED(hr) )
@ -725,7 +725,7 @@ namespace
nullptr,
CLSCTX_INPROC_SERVER,
__uuidof(IWICImagingFactory),
factory
ifactory
);
return SUCCEEDED(hr) ? TRUE : FALSE;
}
@ -735,7 +735,7 @@ namespace
nullptr,
CLSCTX_INPROC_SERVER,
__uuidof(IWICImagingFactory),
factory) ) ? TRUE : FALSE;
ifactory) ) ? TRUE : FALSE;
#endif
}, nullptr, reinterpret_cast<LPVOID*>(&factory));
@ -986,7 +986,7 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
auto_delete_file_wic delonfail(stream, fileName);
ComPtr<IWICBitmapEncoder> encoder;
hr = pWIC->CreateEncoder( guidContainerFormat, 0, encoder.GetAddressOf() );
hr = pWIC->CreateEncoder( guidContainerFormat, nullptr, encoder.GetAddressOf() );
if ( FAILED(hr) )
return hr;

View File

@ -789,14 +789,14 @@ namespace
IWICImagingFactory2* factory = nullptr;
(void)InitOnceExecuteOnce(&s_initOnce,
[](PINIT_ONCE, PVOID, PVOID *factory) -> BOOL
[](PINIT_ONCE, PVOID, PVOID *ifactory) -> BOOL
{
return SUCCEEDED( CoCreateInstance(
CLSID_WICImagingFactory2,
nullptr,
CLSCTX_INPROC_SERVER,
__uuidof(IWICImagingFactory2),
factory) ) ? TRUE : FALSE;
ifactory) ) ? TRUE : FALSE;
}, nullptr, reinterpret_cast<LPVOID*>(&factory));
return factory;
@ -1095,7 +1095,7 @@ HRESULT DirectX::SaveWICTextureToFile( ID3D12CommandQueue* pCommandQ,
auto_delete_file_wic delonfail(stream, fileName);
ComPtr<IWICBitmapEncoder> encoder;
hr = pWIC->CreateEncoder( guidContainerFormat, 0, encoder.GetAddressOf() );
hr = pWIC->CreateEncoder( guidContainerFormat, nullptr, encoder.GetAddressOf() );
if ( FAILED(hr) )
return hr;

View File

@ -641,7 +641,7 @@ namespace
return E_NOINTERFACE;
ComPtr<IWICBitmapDecoder> decoder;
HRESULT hr = pWIC->CreateDecoderFromFilename(szFile, 0, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
HRESULT hr = pWIC->CreateDecoderFromFilename(szFile, nullptr, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
if (FAILED(hr))
return hr;
@ -876,7 +876,7 @@ namespace
auto img = rawFrame.GetImage(0, 0, 0);
hr = FC->CopyPixels(0, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
hr = FC->CopyPixels(nullptr, static_cast<UINT>(img->rowPitch), static_cast<UINT>(img->slicePitch), img->pixels);
if (FAILED(hr))
return hr;

View File

@ -170,7 +170,7 @@ namespace
IWICImagingFactory* factory = nullptr;
InitOnceExecuteOnce(&s_initOnce,
[](PINIT_ONCE, PVOID, PVOID *factory) -> BOOL
[](PINIT_ONCE, PVOID, PVOID *ifactory) -> BOOL
{
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE)
HRESULT hr = CoCreateInstance(
@ -178,7 +178,7 @@ namespace
nullptr,
CLSCTX_INPROC_SERVER,
__uuidof(IWICImagingFactory2),
factory
ifactory
);
if (SUCCEEDED(hr))
@ -194,7 +194,7 @@ namespace
nullptr,
CLSCTX_INPROC_SERVER,
__uuidof(IWICImagingFactory),
factory
ifactory
);
return SUCCEEDED(hr) ? TRUE : FALSE;
}
@ -204,7 +204,7 @@ namespace
nullptr,
CLSCTX_INPROC_SERVER,
__uuidof(IWICImagingFactory),
factory)) ? TRUE : FALSE;
ifactory)) ? TRUE : FALSE;
#endif
}, nullptr, reinterpret_cast<LPVOID*>(&factory));
@ -505,7 +505,7 @@ namespace
&& theight == height)
{
// No format conversion or resize needed
hr = frame->CopyPixels(0, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), temp.get());
hr = frame->CopyPixels(nullptr, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), temp.get());
if (FAILED(hr))
return hr;
}
@ -533,7 +533,7 @@ namespace
if (memcmp(&convertGUID, &pfScaler, sizeof(GUID)) == 0)
{
// No format conversion needed
hr = scaler->CopyPixels(0, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), temp.get());
hr = scaler->CopyPixels(nullptr, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), temp.get());
if (FAILED(hr))
return hr;
}
@ -555,7 +555,7 @@ namespace
if (FAILED(hr))
return hr;
hr = FC->CopyPixels(0, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), temp.get());
hr = FC->CopyPixels(nullptr, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), temp.get());
if (FAILED(hr))
return hr;
}
@ -583,7 +583,7 @@ namespace
if (FAILED(hr))
return hr;
hr = FC->CopyPixels(0, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), temp.get());
hr = FC->CopyPixels(nullptr, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), temp.get());
if (FAILED(hr))
return hr;
}
@ -764,7 +764,7 @@ HRESULT DirectX::CreateWICTextureFromMemoryEx(ID3D11Device* d3dDevice,
// Initialize WIC
ComPtr<IWICBitmapDecoder> decoder;
hr = pWIC->CreateDecoderFromStream(stream.Get(), 0, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
hr = pWIC->CreateDecoderFromStream(stream.Get(), nullptr, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
if (FAILED(hr))
return hr;
@ -866,7 +866,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx(ID3D11Device* d3dDevice,
// Initialize WIC
ComPtr<IWICBitmapDecoder> decoder;
HRESULT hr = pWIC->CreateDecoderFromFilename(fileName, 0, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
HRESULT hr = pWIC->CreateDecoderFromFilename(fileName, nullptr, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf());
if (FAILED(hr))
return hr;

View File

@ -149,14 +149,14 @@ namespace
IWICImagingFactory2* factory = nullptr;
(void)InitOnceExecuteOnce(&s_initOnce,
[](PINIT_ONCE, PVOID, PVOID *factory) -> BOOL
[](PINIT_ONCE, PVOID, PVOID *ifactory) -> BOOL
{
return SUCCEEDED( CoCreateInstance(
CLSID_WICImagingFactory2,
nullptr,
CLSCTX_INPROC_SERVER,
__uuidof(IWICImagingFactory2),
factory) ) ? TRUE : FALSE;
ifactory) ) ? TRUE : FALSE;
}, nullptr, reinterpret_cast<LPVOID*>(&factory));
return factory;
@ -399,7 +399,7 @@ namespace
&& theight == height)
{
// No format conversion or resize needed
hr = frame->CopyPixels(0, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), decodedData.get());
hr = frame->CopyPixels(nullptr, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), decodedData.get());
if (FAILED(hr))
return hr;
}
@ -427,7 +427,7 @@ namespace
if (memcmp(&convertGUID, &pfScaler, sizeof(GUID)) == 0)
{
// No format conversion needed
hr = scaler->CopyPixels(0, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), decodedData.get());
hr = scaler->CopyPixels(nullptr, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), decodedData.get());
if (FAILED(hr))
return hr;
}
@ -449,7 +449,7 @@ namespace
if (FAILED(hr))
return hr;
hr = FC->CopyPixels(0, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), decodedData.get());
hr = FC->CopyPixels(nullptr, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), decodedData.get());
if (FAILED(hr))
return hr;
}
@ -477,7 +477,7 @@ namespace
if (FAILED(hr))
return hr;
hr = FC->CopyPixels(0, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), decodedData.get());
hr = FC->CopyPixels(nullptr, static_cast<UINT>(rowPitch), static_cast<UINT>(imageSize), decodedData.get());
if (FAILED(hr))
return hr;
}
@ -592,7 +592,7 @@ HRESULT DirectX::LoadWICTextureFromMemoryEx(
// Initialize WIC
ComPtr<IWICBitmapDecoder> decoder;
hr = pWIC->CreateDecoderFromStream( stream.Get(), 0, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf() );
hr = pWIC->CreateDecoderFromStream( stream.Get(), nullptr, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf() );
if ( FAILED(hr) )
return hr;
@ -663,7 +663,7 @@ HRESULT DirectX::LoadWICTextureFromFileEx(
// Initialize WIC
ComPtr<IWICBitmapDecoder> decoder;
HRESULT hr = pWIC->CreateDecoderFromFilename( fileName, 0, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf() );
HRESULT hr = pWIC->CreateDecoderFromFilename( fileName, nullptr, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf() );
if ( FAILED(hr) )
return hr;