2 * Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
23 #include "swapchain9ex.h"
26 #include "nine_helpers.h"
28 #define DBG_CHANNEL DBG_SWAPCHAIN
31 NineSwapChain9Ex_ctor( struct NineSwapChain9Ex
*This
,
32 struct NineUnknownParams
*pParams
,
34 ID3DPresent
*pPresent
,
35 D3DPRESENT_PARAMETERS
*pPresentationParameters
,
36 struct d3dadapter9_context
*pCTX
,
38 D3DDISPLAYMODEEX
*mode
)
40 DBG("This=%p pParams=%p implicit=%d pPresent=%p pPresentationParameters=%p "
41 "pCTX=%p hFocusWindow=%p mode=%p",
42 This
, pParams
, (int) implicit
, pPresent
, pPresentationParameters
, pCTX
, hFocusWindow
, mode
);
44 return NineSwapChain9_ctor(&This
->base
, pParams
, implicit
, pPresent
,
45 pPresentationParameters
, pCTX
, hFocusWindow
, mode
);
49 NineSwapChain9Ex_dtor( struct NineSwapChain9Ex
*This
)
51 NineSwapChain9_dtor(&This
->base
);
55 NineSwapChain9Ex_GetLastPresentCount( struct NineSwapChain9Ex
*This
,
56 UINT
*pLastPresentCount
)
58 STUB(D3DERR_INVALIDCALL
);
62 NineSwapChain9Ex_GetPresentStats( struct NineSwapChain9Ex
*This
,
63 D3DPRESENTSTATS
*pPresentationStatistics
)
65 STUB(D3DERR_INVALIDCALL
);
69 NineSwapChain9Ex_GetDisplayModeEx( struct NineSwapChain9Ex
*This
,
70 D3DDISPLAYMODEEX
*pMode
,
71 D3DDISPLAYROTATION
*pRotation
)
73 D3DDISPLAYROTATION rot
;
75 user_assert(pMode
!= NULL
, E_POINTER
);
76 if (!pRotation
) { pRotation
= &rot
; }
78 return ID3DPresent_GetDisplayMode(This
->base
.present
, pMode
, pRotation
);
81 IDirect3DSwapChain9ExVtbl NineSwapChain9Ex_vtable
= {
82 (void *)NineUnknown_QueryInterface
,
83 (void *)NineUnknown_AddRef
,
84 (void *)NineUnknown_Release
,
85 (void *)NineSwapChain9_Present
,
86 (void *)NineSwapChain9_GetFrontBufferData
,
87 (void *)NineSwapChain9_GetBackBuffer
,
88 (void *)NineSwapChain9_GetRasterStatus
,
89 (void *)NineSwapChain9_GetDisplayMode
,
90 (void *)NineUnknown_GetDevice
, /* actually part of NineSwapChain9 iface */
91 (void *)NineSwapChain9_GetPresentParameters
,
92 (void *)NineSwapChain9Ex_GetLastPresentCount
,
93 (void *)NineSwapChain9Ex_GetPresentStats
,
94 (void *)NineSwapChain9Ex_GetDisplayModeEx
97 static const GUID
*NineSwapChain9Ex_IIDs
[] = {
98 &IID_IDirect3DSwapChain9Ex
,
99 &IID_IDirect3DSwapChain9
,
105 NineSwapChain9Ex_new( struct NineDevice9
*pDevice
,
107 ID3DPresent
*pPresent
,
108 D3DPRESENT_PARAMETERS
*pPresentationParameters
,
109 struct d3dadapter9_context
*pCTX
,
111 D3DDISPLAYMODEEX
*mode
,
112 struct NineSwapChain9Ex
**ppOut
)
114 NINE_DEVICE_CHILD_NEW(SwapChain9Ex
, ppOut
, pDevice
, /* args */
115 implicit
, pPresent
, pPresentationParameters
,
116 pCTX
, hFocusWindow
, mode
);