From 0ef4a78e4a9d580be2c5aff737e99fcc257c1df6 Mon Sep 17 00:00:00 2001 From: walbourn_cp Date: Tue, 30 Oct 2012 17:31:19 -0700 Subject: [PATCH] Updated WICTextureLoader and ScreenGrab with Windows Phone 8 guards --- ScreenGrab/ScreenGrab.cpp | 12 +++++++++++- ScreenGrab/ScreenGrab.h | 4 ++++ WICTextureLoader/WICTextureLoader.h | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ScreenGrab/ScreenGrab.cpp b/ScreenGrab/ScreenGrab.cpp index 995785d..a159a4b 100644 --- a/ScreenGrab/ScreenGrab.cpp +++ b/ScreenGrab/ScreenGrab.cpp @@ -28,10 +28,12 @@ #include #include +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) #pragma warning(push) #pragma warning(disable : 4005) #include #pragma warning(pop) +#endif #include @@ -620,6 +622,8 @@ static HRESULT CaptureTexture( _In_ ID3D11DeviceContext* pContext, //-------------------------------------------------------------------------------------- +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) + static IWICImagingFactory* _GetWIC() { static IWICImagingFactory* s_Factory = nullptr; @@ -644,6 +648,8 @@ static IWICImagingFactory* _GetWIC() return s_Factory; } +#endif + //-------------------------------------------------------------------------------------- HRESULT DirectX::SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, @@ -793,6 +799,8 @@ HRESULT DirectX::SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, } //-------------------------------------------------------------------------------------- +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) + HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, _In_ REFGUID guidContainerFormat, @@ -1005,4 +1013,6 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, return hr; return S_OK; -} \ No newline at end of file +} + +#endif // !WINAPI_FAMILY || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) diff --git a/ScreenGrab/ScreenGrab.h b/ScreenGrab/ScreenGrab.h index 674680f..d4d82c9 100644 --- a/ScreenGrab/ScreenGrab.h +++ b/ScreenGrab/ScreenGrab.h @@ -36,9 +36,13 @@ namespace DirectX _In_ ID3D11Resource* pSource, _In_z_ LPCWSTR fileName ); +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) + HRESULT SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, _In_ REFGUID guidContainerFormat, _In_z_ LPCWSTR fileName, _In_opt_ const GUID* targetFormat = nullptr ); + +#endif } \ No newline at end of file diff --git a/WICTextureLoader/WICTextureLoader.h b/WICTextureLoader/WICTextureLoader.h index 37a115a..86a5b56 100644 --- a/WICTextureLoader/WICTextureLoader.h +++ b/WICTextureLoader/WICTextureLoader.h @@ -29,6 +29,10 @@ #pragma once #endif +#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#error WIC is not supported on Windows Phone +#endif + #include #pragma warning(push)