Skip to content

Commit

Permalink
Screengrab updated to handle SRGB formats
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn_cp authored and walbourn_cp committed Oct 9, 2012
1 parent bd98eaa commit f887115
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Src/ScreenGrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,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;
Expand All @@ -586,6 +583,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 );
}
Expand Down

0 comments on commit f887115

Please sign in to comment.