mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-09 19:50:13 +02:00
DirectXTex: when building for WinRT, use InMemoryRandomAccessStream instead CreateStreamOnHGlobal
This commit is contained in:
parent
887d87bf91
commit
a303eea709
@ -15,6 +15,11 @@
|
|||||||
|
|
||||||
#include "directxtexp.h"
|
#include "directxtexp.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus_winrt
|
||||||
|
#include <shcore.h>
|
||||||
|
#pragma comment(lib,"shcore.lib")
|
||||||
|
#endif
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
// WIC Pixel Format nearest conversion table
|
// WIC Pixel Format nearest conversion table
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
@ -918,7 +923,12 @@ HRESULT SaveToWICMemory( const Image& image, DWORD flags, REFGUID containerForma
|
|||||||
blob.Release();
|
blob.Release();
|
||||||
|
|
||||||
ScopedObject<IStream> stream;
|
ScopedObject<IStream> stream;
|
||||||
|
#ifdef __cplusplus_winrt
|
||||||
|
auto randomAccessStream = ref new Windows::Storage::Streams::InMemoryRandomAccessStream();
|
||||||
|
HRESULT hr = CreateStreamOverRandomAccessStream( randomAccessStream, __uuidof(IStream), reinterpret_cast<void **>( &stream ) );
|
||||||
|
#else
|
||||||
HRESULT hr = CreateStreamOnHGlobal( 0, TRUE, &stream );
|
HRESULT hr = CreateStreamOnHGlobal( 0, TRUE, &stream );
|
||||||
|
#endif
|
||||||
if ( FAILED(hr) )
|
if ( FAILED(hr) )
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
@ -965,7 +975,12 @@ HRESULT SaveToWICMemory( const Image* images, size_t nimages, DWORD flags, REFGU
|
|||||||
blob.Release();
|
blob.Release();
|
||||||
|
|
||||||
ScopedObject<IStream> stream;
|
ScopedObject<IStream> stream;
|
||||||
|
#ifdef __cplusplus_winrt
|
||||||
|
auto randomAccessStream = ref new Windows::Storage::Streams::InMemoryRandomAccessStream();
|
||||||
|
HRESULT hr = CreateStreamOverRandomAccessStream( randomAccessStream, __uuidof(IStream), reinterpret_cast<void **>( &stream ) );
|
||||||
|
#else
|
||||||
HRESULT hr = CreateStreamOnHGlobal( 0, TRUE, &stream );
|
HRESULT hr = CreateStreamOnHGlobal( 0, TRUE, &stream );
|
||||||
|
#endif
|
||||||
if ( FAILED(hr) )
|
if ( FAILED(hr) )
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user