1#pragma once 2 3#include "pch.h" 4#include <wrl/module.h> 5#include <Windows.Phone.Graphics.Interop.h> 6#include <DrawingSurfaceNative.h> 7 8#include "Direct3DInterop.h" 9 10class Direct3DContentProvider : public Microsoft::WRL::RuntimeClass< 11 Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::WinRtClassicComMix>, 12 ABI::Windows::Phone::Graphics::Interop::IDrawingSurfaceContentProvider, 13 IDrawingSurfaceContentProviderNative> 14{ 15public: 16 Direct3DContentProvider(PhoneXamlDirect3DApp1Comp::Direct3DInterop^ controller); 17 18 void ReleaseD3DResources(); 19 20 // IDrawingSurfaceContentProviderNative 21 HRESULT STDMETHODCALLTYPE Connect(_In_ IDrawingSurfaceRuntimeHostNative* host); 22 void STDMETHODCALLTYPE Disconnect(); 23 24 HRESULT STDMETHODCALLTYPE PrepareResources(_In_ const LARGE_INTEGER* presentTargetTime, _Out_ BOOL* contentDirty); 25 HRESULT STDMETHODCALLTYPE GetTexture(_In_ const DrawingSurfaceSizeF* size, _Out_ IDrawingSurfaceSynchronizedTextureNative** synchronizedTexture, _Out_ DrawingSurfaceRectF* textureSubRectangle); 26 27private: 28 HRESULT InitializeTexture(_In_ const DrawingSurfaceSizeF* size); 29 30 PhoneXamlDirect3DApp1Comp::Direct3DInterop^ m_controller; 31 Microsoft::WRL::ComPtr<IDrawingSurfaceRuntimeHostNative> m_host; 32 Microsoft::WRL::ComPtr<IDrawingSurfaceSynchronizedTextureNative> m_synchronizedTexture; 33};