static HRESULT WINAPI d3d8_swapchain_GetBackBuffer(IDirect3DSwapChain8 *iface, UINT backbuffer_idx, D3DBACKBUFFER_TYPE backbuffer_type, IDirect3DSurface8 **backbuffer) { struct d3d8_swapchain *swapchain = impl_from_IDirect3DSwapChain8(iface); struct wined3d_surface *wined3d_surface = NULL; struct d3d8_surface *surface_impl; HRESULT hr = D3D_OK; TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", iface, backbuffer_idx, backbuffer_type, backbuffer); wined3d_mutex_lock(); if ((wined3d_surface = wined3d_swapchain_get_back_buffer(swapchain->wined3d_swapchain, backbuffer_idx, (enum wined3d_backbuffer_type)backbuffer_type))) { surface_impl = wined3d_surface_get_parent(wined3d_surface); *backbuffer = &surface_impl->IDirect3DSurface8_iface; IDirect3DSurface8_AddRef(*backbuffer); } else { hr = D3DERR_INVALIDCALL; } wined3d_mutex_unlock(); return hr; }
static HRESULT WINAPI d3d8_swapchain_Present(IDirect3DSwapChain8 *iface, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region) { struct d3d8_swapchain *swapchain = impl_from_IDirect3DSwapChain8(iface); HRESULT hr; TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p.\n", iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), dst_window_override, dirty_region); wined3d_mutex_lock(); hr = wined3d_swapchain_present(swapchain->wined3d_swapchain, src_rect, dst_rect, dst_window_override, dirty_region, 0); wined3d_mutex_unlock(); return hr; }
static HRESULT WINAPI IDirect3DSwapChain8Impl_Present(IDirect3DSwapChain8 *iface, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion) { IDirect3DSwapChain8Impl *This = impl_from_IDirect3DSwapChain8(iface); HRESULT hr; TRACE("iface %p, src_rect %p, dst_rect %p, dst_window_override %p, dirty_region %p.\n", iface, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); wined3d_mutex_lock(); hr = wined3d_swapchain_present(This->wined3d_swapchain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, 0); wined3d_mutex_unlock(); return hr; }
static ULONG WINAPI d3d8_swapchain_AddRef(IDirect3DSwapChain8 *iface) { struct d3d8_swapchain *swapchain = impl_from_IDirect3DSwapChain8(iface); ULONG ref = InterlockedIncrement(&swapchain->refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); if (ref == 1) { if (swapchain->parent_device) IDirect3DDevice8_AddRef(swapchain->parent_device); wined3d_mutex_lock(); wined3d_swapchain_incref(swapchain->wined3d_swapchain); wined3d_mutex_unlock(); } return ref; }
static ULONG WINAPI IDirect3DSwapChain8Impl_AddRef(IDirect3DSwapChain8 *iface) { IDirect3DSwapChain8Impl *This = impl_from_IDirect3DSwapChain8(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); if (ref == 1) { if (This->parentDevice) IDirect3DDevice8_AddRef(This->parentDevice); wined3d_mutex_lock(); wined3d_swapchain_incref(This->wined3d_swapchain); wined3d_mutex_unlock(); } return ref; }
static HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(IDirect3DSwapChain8 *iface, REFIID riid, void **ppobj) { IDirect3DSwapChain8Impl *This = impl_from_IDirect3DSwapChain8(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirect3DSwapChain8)) { IUnknown_AddRef(iface); *ppobj = This; return S_OK; } WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); *ppobj = NULL; return E_NOINTERFACE; }
static ULONG WINAPI d3d8_swapchain_Release(IDirect3DSwapChain8 *iface) { struct d3d8_swapchain *swapchain = impl_from_IDirect3DSwapChain8(iface); ULONG ref = InterlockedDecrement(&swapchain->refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); if (!ref) { IDirect3DDevice8 *parent_device = swapchain->parent_device; wined3d_mutex_lock(); wined3d_swapchain_decref(swapchain->wined3d_swapchain); wined3d_mutex_unlock(); if (parent_device) IDirect3DDevice8_Release(parent_device); } return ref; }
static ULONG WINAPI IDirect3DSwapChain8Impl_Release(IDirect3DSwapChain8 *iface) { IDirect3DSwapChain8Impl *This = impl_from_IDirect3DSwapChain8(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); if (!ref) { IDirect3DDevice8 *parentDevice = This->parentDevice; wined3d_mutex_lock(); wined3d_swapchain_decref(This->wined3d_swapchain); wined3d_mutex_unlock(); if (parentDevice) IDirect3DDevice8_Release(parentDevice); } return ref; }
static HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(IDirect3DSwapChain8 *iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8 **ppBackBuffer) { IDirect3DSwapChain8Impl *This = impl_from_IDirect3DSwapChain8(iface); struct wined3d_surface *wined3d_surface = NULL; HRESULT hr; TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", iface, iBackBuffer, Type, ppBackBuffer); wined3d_mutex_lock(); hr = wined3d_swapchain_get_back_buffer(This->wined3d_swapchain, iBackBuffer, (enum wined3d_backbuffer_type)Type, &wined3d_surface); if (SUCCEEDED(hr) && wined3d_surface) { *ppBackBuffer = wined3d_surface_get_parent(wined3d_surface); IDirect3DSurface8_AddRef(*ppBackBuffer); wined3d_surface_decref(wined3d_surface); } wined3d_mutex_unlock(); return hr; }