DDSTextureLoader/WICTextureLoader: Fixed forceSRGB logic (DirectxTK Codeplex issue 851)

Integrated some code review feedback
This commit is contained in:
walbourn_cp
2013-01-28 14:24:03 -08:00
parent 171f49b741
commit 6b8936dc50
3 changed files with 58 additions and 37 deletions

View File

@@ -788,7 +788,9 @@ HRESULT DirectX::SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext,
}
// Setup pixels
std::unique_ptr<uint8_t> pixels( new uint8_t[ slicePitch ] );
std::unique_ptr<uint8_t> pixels( new (std::nothrow) uint8_t[ slicePitch ] );
if (!pixels)
return E_OUTOFMEMORY;
D3D11_MAPPED_SUBRESOURCE mapped;
hr = pContext->Map( pStaging.Get(), 0, D3D11_MAP_READ, 0, &mapped );
@@ -841,9 +843,7 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
_In_opt_ const GUID* targetFormat )
{
if ( !fileName )
{
return E_INVALIDARG;
}
D3D11_TEXTURE2D_DESC desc = { 0 };
ScopedObject<ID3D11Texture2D> pStaging;