mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-15 14:30:13 +02:00
Added explicit test of CanConvert for all use of IWICFormatConverter
This commit is contained in:
parent
48e969aac7
commit
7ba4a6504f
@ -1111,6 +1111,13 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
|||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL canConvert = FALSE;
|
||||||
|
hr = FC->CanConvert( pfGuid, targetGuid, &canConvert );
|
||||||
|
if ( FAILED(hr) || !canConvert )
|
||||||
|
{
|
||||||
|
return E_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
hr = FC->Initialize( source.Get(), targetGuid, WICBitmapDitherTypeNone, 0, 0, WICBitmapPaletteTypeCustom );
|
hr = FC->Initialize( source.Get(), targetGuid, WICBitmapDitherTypeNone, 0, 0, WICBitmapPaletteTypeCustom );
|
||||||
if ( FAILED(hr) )
|
if ( FAILED(hr) )
|
||||||
{
|
{
|
||||||
|
@ -554,6 +554,13 @@ static HRESULT CreateTextureFromWIC( _In_ ID3D11Device* d3dDevice,
|
|||||||
if ( FAILED(hr) )
|
if ( FAILED(hr) )
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
|
BOOL canConvert = FALSE;
|
||||||
|
hr = FC->CanConvert( pfScaler, convertGUID, &canConvert );
|
||||||
|
if ( FAILED(hr) || !canConvert )
|
||||||
|
{
|
||||||
|
return E_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
hr = FC->Initialize( scaler.Get(), convertGUID, WICBitmapDitherTypeErrorDiffusion, 0, 0, WICBitmapPaletteTypeCustom );
|
hr = FC->Initialize( scaler.Get(), convertGUID, WICBitmapDitherTypeErrorDiffusion, 0, 0, WICBitmapPaletteTypeCustom );
|
||||||
if ( FAILED(hr) )
|
if ( FAILED(hr) )
|
||||||
return hr;
|
return hr;
|
||||||
@ -575,6 +582,13 @@ static HRESULT CreateTextureFromWIC( _In_ ID3D11Device* d3dDevice,
|
|||||||
if ( FAILED(hr) )
|
if ( FAILED(hr) )
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
|
BOOL canConvert = FALSE;
|
||||||
|
hr = FC->CanConvert( pixelFormat, convertGUID, &canConvert );
|
||||||
|
if ( FAILED(hr) || !canConvert )
|
||||||
|
{
|
||||||
|
return E_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
hr = FC->Initialize( frame, convertGUID, WICBitmapDitherTypeErrorDiffusion, 0, 0, WICBitmapPaletteTypeCustom );
|
hr = FC->Initialize( frame, convertGUID, WICBitmapDitherTypeErrorDiffusion, 0, 0, WICBitmapPaletteTypeCustom );
|
||||||
if ( FAILED(hr) )
|
if ( FAILED(hr) )
|
||||||
return hr;
|
return hr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user