Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Commit

Permalink
SwapChain.Present and SwapChain1.Present now return their result code…
Browse files Browse the repository at this point in the history
…s so that the application can check whether the window is occluded. This should resolve #746.
  • Loading branch information
waltdestler committed May 30, 2016
1 parent c5a6efa commit 2bce60c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Source/SharpDX.DXGI/Mapping.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@
<map param="IVirtualSurfaceImageSourceNative::GetUpdateRectCount::count" return="true"/>
<map method="IVirtualSurfaceImageSourceNative::GetUpdateRects" visibility="internal"/>

<map method="IDXGISwapChain1::Present1" visibility="internal"/>
<map method="IDXGISwapChain::Present" hresult="true"/>
<map method="IDXGISwapChain1::Present1" visibility="internal" hresult="true"/>
<map param="IDXGISwapChain1::Present1::pPresentParameters" type="void"/>
<map param="IDXGISwapChain1::Present1::PresentFlags" type="DXGI_PRESENT_FLAGS" />

Expand Down
4 changes: 2 additions & 2 deletions Source/SharpDX.DXGI/SwapChain1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public SwapChain1(Factory2 factory, ComObject device, ref SwapChainDescription1
/// </remarks>
/// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='IDXGISwapChain1::Present1']/*"/>
/// <unmanaged>HRESULT IDXGISwapChain1::Present1([In] unsigned int SyncInterval,[In] unsigned int PresentFlags,[In] const void* pPresentParameters)</unmanaged>
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;
Expand All @@ -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));
}
}
}
Expand Down

0 comments on commit 2bce60c

Please sign in to comment.