From 2bce60c5892141a214fda9c98d418d59aac56c64 Mon Sep 17 00:00:00 2001 From: Walt Destler Date: Mon, 30 May 2016 07:25:32 -0700 Subject: [PATCH] SwapChain.Present and SwapChain1.Present now return their result codes so that the application can check whether the window is occluded. This should resolve #746. --- Source/SharpDX.DXGI/Mapping.xml | 3 ++- Source/SharpDX.DXGI/SwapChain1.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/SharpDX.DXGI/Mapping.xml b/Source/SharpDX.DXGI/Mapping.xml index f5db86e22..f59ba276b 100644 --- a/Source/SharpDX.DXGI/Mapping.xml +++ b/Source/SharpDX.DXGI/Mapping.xml @@ -227,7 +227,8 @@ - + + diff --git a/Source/SharpDX.DXGI/SwapChain1.cs b/Source/SharpDX.DXGI/SwapChain1.cs index 4b6d0bac6..edd5a0211 100644 --- a/Source/SharpDX.DXGI/SwapChain1.cs +++ b/Source/SharpDX.DXGI/SwapChain1.cs @@ -79,7 +79,7 @@ public SwapChain1(Factory2 factory, ComObject device, ref SwapChainDescription1 /// /// /// HRESULT IDXGISwapChain1::Present1([In] unsigned int SyncInterval,[In] unsigned int PresentFlags,[In] const void* pPresentParameters) - public unsafe void Present(int syncInterval, PresentFlags presentFlags, PresentParameters presentParameters) + public unsafe Result Present(int syncInterval, PresentFlags presentFlags, PresentParameters presentParameters) { bool hasScrollRectangle = presentParameters.ScrollRectangle.HasValue; bool hasScrollOffset = presentParameters.ScrollOffset.HasValue; @@ -95,7 +95,7 @@ public unsafe void Present(int syncInterval, PresentFlags presentFlags, PresentP native.PScrollRect = hasScrollRectangle ? new IntPtr(&scrollRectangle) : IntPtr.Zero; native.PScrollOffset = hasScrollOffset ? new IntPtr(&scrollOffset) : IntPtr.Zero; - Present1(syncInterval, presentFlags, new IntPtr(&native)); + return Present1(syncInterval, presentFlags, new IntPtr(&native)); } } }