Screengrab: Updated to handle SRGB formats

See http://directxtk.codeplex.com/workitem/780
This commit is contained in:
walbourn_cp 2012-10-09 14:52:02 -07:00
parent 28faae7447
commit e57fcf3817

View File

@ -777,9 +777,6 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
case DXGI_FORMAT_R32G32B32A32_FLOAT: pfGuid = GUID_WICPixelFormat128bppRGBAFloat; break;
case DXGI_FORMAT_R16G16B16A16_FLOAT: pfGuid = GUID_WICPixelFormat64bppRGBAHalf; break;
case DXGI_FORMAT_R16G16B16A16_UNORM: pfGuid = GUID_WICPixelFormat64bppRGBA; break;
case DXGI_FORMAT_R8G8B8A8_UNORM: pfGuid = GUID_WICPixelFormat32bppRGBA; break;
case DXGI_FORMAT_B8G8R8A8_UNORM: pfGuid = GUID_WICPixelFormat32bppBGRA; break; // DXGI 1.1
case DXGI_FORMAT_B8G8R8X8_UNORM: pfGuid = GUID_WICPixelFormat32bppBGR; break; // DXGI 1.1
case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: pfGuid = GUID_WICPixelFormat32bppRGBA1010102XR; break; // DXGI 1.1
case DXGI_FORMAT_R10G10B10A2_UNORM: pfGuid = GUID_WICPixelFormat32bppRGBA1010102; break;
case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: pfGuid = GUID_WICPixelFormat32bppRGBE; break;
@ -791,6 +788,21 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
case DXGI_FORMAT_R8_UNORM: pfGuid = GUID_WICPixelFormat8bppGray; break;
case DXGI_FORMAT_A8_UNORM: pfGuid = GUID_WICPixelFormat8bppAlpha; break;
case DXGI_FORMAT_R8G8B8A8_UNORM:
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
pfGuid = GUID_WICPixelFormat32bppRGBA;
break;
case DXGI_FORMAT_B8G8R8A8_UNORM: // DXGI 1.1
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
pfGuid = GUID_WICPixelFormat32bppBGRA;
break;
case DXGI_FORMAT_B8G8R8X8_UNORM: // DXGI 1.1
case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
pfGuid = GUID_WICPixelFormat32bppBGR;
break;
default:
return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
}