2009-01-09 12:23:17 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Stefan Dösinger for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
2009-08-31 11:53:08 +02:00
|
|
|
#define NONAMELESSUNION
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2009-08-31 11:53:08 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include "windef.h"
|
2009-01-09 12:23:17 +01:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
|
|
|
|
#include "ddraw.h"
|
|
|
|
#include "d3d.h"
|
|
|
|
|
|
|
|
#include "ddrawex_private.h"
|
2009-08-31 11:53:08 +02:00
|
|
|
#include "wine/debug.h"
|
2009-01-09 12:23:17 +01:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ddrawex);
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static struct ddrawex *impl_from_IDirectDraw(IDirectDraw *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddrawex, IDirectDraw_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static struct ddrawex *impl_from_IDirectDraw2(IDirectDraw2 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddrawex, IDirectDraw2_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static struct ddrawex *impl_from_IDirectDraw3(IDirectDraw3 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddrawex, IDirectDraw3_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static struct ddrawex *impl_from_IDirectDraw4(IDirectDraw4 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddrawex, IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_QueryInterface(IDirectDraw4 *iface, REFIID riid, void **out)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
if (!riid)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
*out = NULL;
|
2009-01-09 12:23:17 +01:00
|
|
|
return DDERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
if (IsEqualGUID(&IID_IDirectDraw4, riid)
|
|
|
|
|| IsEqualGUID(&IID_IUnknown, riid))
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
*out = &ddrawex->IDirectDraw4_iface;
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
2013-11-12 11:00:28 +01:00
|
|
|
else if (IsEqualGUID(&IID_IDirectDraw3, riid))
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
*out = &ddrawex->IDirectDraw3_iface;
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
2013-11-12 11:00:28 +01:00
|
|
|
else if (IsEqualGUID(&IID_IDirectDraw2, riid))
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
*out = &ddrawex->IDirectDraw2_iface;
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
2013-11-12 11:00:28 +01:00
|
|
|
else if (IsEqualGUID(&IID_IDirectDraw, riid))
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
*out = &ddrawex->IDirectDraw_iface;
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
*out = NULL;
|
|
|
|
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
|
2009-01-09 12:23:17 +01:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
2013-11-12 11:00:28 +01:00
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown *)*out);
|
2009-01-09 12:23:17 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_QueryInterface(IDirectDraw3 *iface, REFIID riid, void **out)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
|
|
|
|
|
|
|
return ddrawex4_QueryInterface(&ddrawex->IDirectDraw4_iface, riid, out);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_QueryInterface(IDirectDraw2 *iface, REFIID riid, void **out)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
|
|
|
|
|
|
|
return ddrawex4_QueryInterface(&ddrawex->IDirectDraw4_iface, riid, out);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_QueryInterface(IDirectDraw *iface, REFIID riid, void **out)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
|
|
|
|
|
|
|
return ddrawex4_QueryInterface(&ddrawex->IDirectDraw4_iface, riid, out);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static ULONG WINAPI ddrawex4_AddRef(IDirectDraw4 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
ULONG refcount = InterlockedIncrement(&ddrawex->ref);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
return refcount;
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static ULONG WINAPI ddrawex3_AddRef(IDirectDraw3 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_AddRef(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static ULONG WINAPI ddrawex2_AddRef(IDirectDraw2 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_AddRef(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static ULONG WINAPI ddrawex1_AddRef(IDirectDraw *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_AddRef(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static ULONG WINAPI ddrawex4_Release(IDirectDraw4 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
ULONG refcount = InterlockedDecrement(&ddrawex->ref);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
if (!refcount)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
IDirectDraw4_Release(ddrawex->parent);
|
|
|
|
HeapFree(GetProcessHeap(), 0, ddrawex);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
2013-11-12 11:00:28 +01:00
|
|
|
|
|
|
|
return refcount;
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static ULONG WINAPI ddrawex3_Release(IDirectDraw3 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_Release(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static ULONG WINAPI ddrawex2_Release(IDirectDraw2 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_Release(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static ULONG WINAPI ddrawex1_Release(IDirectDraw *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_Release(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_Compact(IDirectDraw4 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
return IDirectDraw4_Compact(ddrawex->parent);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_Compact(IDirectDraw3 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_Compact(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_Compact(IDirectDraw2 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_Compact(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_Compact(IDirectDraw *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_Compact(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_CreateClipper(IDirectDraw4 *iface, DWORD flags,
|
|
|
|
IDirectDrawClipper **clipper, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n",
|
|
|
|
iface, flags, clipper, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
/* This may require a wrapper interface for clippers too which handles this. */
|
|
|
|
if (outer_unknown)
|
|
|
|
FIXME("Test and implement aggregation for ddrawex clippers.\n");
|
|
|
|
|
|
|
|
return IDirectDraw4_CreateClipper(ddrawex->parent, flags, clipper, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_CreateClipper(IDirectDraw3 *iface, DWORD flags,
|
|
|
|
IDirectDrawClipper **clipper, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n",
|
|
|
|
iface, flags, clipper, outer_unknown);
|
|
|
|
|
|
|
|
return ddrawex4_CreateClipper(&ddrawex->IDirectDraw4_iface, flags, clipper, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_CreateClipper(IDirectDraw2 *iface, DWORD flags,
|
|
|
|
IDirectDrawClipper **clipper, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n",
|
|
|
|
iface, flags, clipper, outer_unknown);
|
|
|
|
|
|
|
|
return ddrawex4_CreateClipper(&ddrawex->IDirectDraw4_iface, flags, clipper, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_CreateClipper(IDirectDraw *iface, DWORD flags,
|
|
|
|
IDirectDrawClipper **clipper, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n",
|
|
|
|
iface, flags, clipper, outer_unknown);
|
|
|
|
|
|
|
|
return ddrawex4_CreateClipper(&ddrawex->IDirectDraw4_iface, flags, clipper, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_CreatePalette(IDirectDraw4 *iface, DWORD flags,
|
|
|
|
PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, flags %#x. entries %p, palette %p, outer_unknown %p.\n",
|
|
|
|
iface, flags, entries, palette, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
/* This may require a wrapper interface for palettes too which handles this. */
|
|
|
|
if (outer_unknown)
|
|
|
|
FIXME("Test and implement aggregation for ddrawex palettes.\n");
|
|
|
|
|
|
|
|
return IDirectDraw4_CreatePalette(ddrawex->parent, flags, entries, palette, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_CreatePalette(IDirectDraw3 *iface, DWORD flags,
|
|
|
|
PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x. entries %p, palette %p, outer_unknown %p.\n",
|
|
|
|
iface, flags, entries, palette, outer_unknown);
|
|
|
|
|
|
|
|
return ddrawex4_CreatePalette(&ddrawex->IDirectDraw4_iface, flags, entries, palette, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_CreatePalette(IDirectDraw2 *iface, DWORD flags,
|
|
|
|
PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x. entries %p, palette %p, outer_unknown %p.\n",
|
|
|
|
iface, flags, entries, palette, outer_unknown);
|
|
|
|
|
|
|
|
return ddrawex4_CreatePalette(&ddrawex->IDirectDraw4_iface, flags, entries, palette, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_CreatePalette(IDirectDraw *iface, DWORD flags,
|
|
|
|
PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x. entries %p, palette %p, outer_unknown %p.\n",
|
|
|
|
iface, flags, entries, palette, outer_unknown);
|
|
|
|
|
|
|
|
return ddrawex4_CreatePalette(&ddrawex->IDirectDraw4_iface, flags, entries, palette, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_CreateSurface(IDirectDraw4 *iface, DDSURFACEDESC2 *desc,
|
|
|
|
IDirectDrawSurface4 **surface, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
2008-12-18 15:40:55 +01:00
|
|
|
HRESULT hr;
|
2008-12-18 16:13:06 +01:00
|
|
|
const DWORD perm_dc_flags = DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
|
|
|
|
BOOL permanent_dc;
|
2014-09-04 13:18:16 +02:00
|
|
|
IDirectDrawSurface4 *inner_surface;
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, desc %p, surface %p, outer_unknown %p.\n",
|
|
|
|
iface, desc, surface, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
/* Handle this in this dll. Don't forward the outer_unknown to ddraw.dll. */
|
|
|
|
if (outer_unknown)
|
|
|
|
FIXME("Implement aggregation for ddrawex surfaces.\n");
|
|
|
|
|
|
|
|
/* Plain ddraw.dll refuses to create a surface that has both VIDMEM and
|
|
|
|
* SYSMEM flags set. In ddrawex this succeeds, and the GetDC() call
|
|
|
|
* changes the behavior. The DC is permanently valid, and the surface can
|
|
|
|
* be locked between GetDC() and ReleaseDC() calls. GetDC() can be called
|
|
|
|
* more than once too. */
|
|
|
|
if ((desc->ddsCaps.dwCaps & perm_dc_flags) == perm_dc_flags)
|
2008-12-18 16:13:06 +01:00
|
|
|
{
|
|
|
|
permanent_dc = TRUE;
|
2013-11-12 11:00:28 +01:00
|
|
|
desc->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
|
|
|
|
desc->ddsCaps.dwCaps |= DDSCAPS_OWNDC;
|
2008-12-18 16:13:06 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
permanent_dc = FALSE;
|
|
|
|
}
|
|
|
|
|
2014-09-04 13:18:16 +02:00
|
|
|
hr = IDirectDraw4_CreateSurface(ddrawex->parent, desc, &inner_surface, outer_unknown);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
*surface = NULL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
*surface = dds_get_outer(inner_surface);
|
|
|
|
/* The wrapper created by dds_get_outer holds a reference to its inner surface. */
|
|
|
|
IDirectDrawSurface4_Release(inner_surface);
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
if (permanent_dc)
|
|
|
|
prepare_permanent_dc(*surface);
|
|
|
|
|
2008-12-18 15:40:55 +01:00
|
|
|
return hr;
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2008-12-18 15:40:55 +01:00
|
|
|
void DDSD_to_DDSD2(const DDSURFACEDESC *in, DDSURFACEDESC2 *out)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
|
|
|
memset(out, 0, sizeof(*out));
|
|
|
|
out->dwSize = sizeof(*out);
|
|
|
|
out->dwFlags = in->dwFlags;
|
|
|
|
if(in->dwFlags & DDSD_WIDTH) out->dwWidth = in->dwWidth;
|
|
|
|
if(in->dwFlags & DDSD_HEIGHT) out->dwHeight = in->dwHeight;
|
2009-08-31 11:53:08 +02:00
|
|
|
if(in->dwFlags & DDSD_PIXELFORMAT) out->u4.ddpfPixelFormat = in->ddpfPixelFormat;
|
2009-01-09 12:23:17 +01:00
|
|
|
if(in->dwFlags & DDSD_CAPS) out->ddsCaps.dwCaps = in->ddsCaps.dwCaps;
|
2009-08-31 11:53:08 +02:00
|
|
|
if(in->dwFlags & DDSD_PITCH) out->u1.lPitch = in->u1.lPitch;
|
2015-02-28 09:22:59 +01:00
|
|
|
if(in->dwFlags & DDSD_BACKBUFFERCOUNT) out->u5.dwBackBufferCount = in->dwBackBufferCount;
|
2009-08-31 11:53:08 +02:00
|
|
|
if(in->dwFlags & DDSD_ZBUFFERBITDEPTH) out->u2.dwMipMapCount = in->u2.dwZBufferBitDepth; /* same union */
|
2009-01-09 12:23:17 +01:00
|
|
|
if(in->dwFlags & DDSD_ALPHABITDEPTH) out->dwAlphaBitDepth = in->dwAlphaBitDepth;
|
2008-12-18 15:40:55 +01:00
|
|
|
/* DDraw(native, and wine) does not set the DDSD_LPSURFACE, so always copy */
|
|
|
|
out->lpSurface = in->lpSurface;
|
2009-08-31 11:53:08 +02:00
|
|
|
if(in->dwFlags & DDSD_CKDESTOVERLAY) out->u3.ddckCKDestOverlay = in->ddckCKDestOverlay;
|
2009-01-09 12:23:17 +01:00
|
|
|
if(in->dwFlags & DDSD_CKDESTBLT) out->ddckCKDestBlt = in->ddckCKDestBlt;
|
|
|
|
if(in->dwFlags & DDSD_CKSRCOVERLAY) out->ddckCKSrcOverlay = in->ddckCKSrcOverlay;
|
|
|
|
if(in->dwFlags & DDSD_CKSRCBLT) out->ddckCKSrcBlt = in->ddckCKSrcBlt;
|
2009-08-31 11:53:08 +02:00
|
|
|
if(in->dwFlags & DDSD_MIPMAPCOUNT) out->u2.dwMipMapCount = in->u2.dwMipMapCount;
|
|
|
|
if(in->dwFlags & DDSD_REFRESHRATE) out->u2.dwRefreshRate = in->u2.dwRefreshRate;
|
|
|
|
if(in->dwFlags & DDSD_LINEARSIZE) out->u1.dwLinearSize = in->u1.dwLinearSize;
|
2009-01-09 12:23:17 +01:00
|
|
|
/* Does not exist in DDSURFACEDESC:
|
|
|
|
* DDSD_TEXTURESTAGE, DDSD_FVF, DDSD_SRCVBHANDLE,
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2008-12-18 15:40:55 +01:00
|
|
|
void DDSD2_to_DDSD(const DDSURFACEDESC2 *in, DDSURFACEDESC *out)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
|
|
|
memset(out, 0, sizeof(*out));
|
|
|
|
out->dwSize = sizeof(*out);
|
|
|
|
out->dwFlags = in->dwFlags;
|
|
|
|
if(in->dwFlags & DDSD_WIDTH) out->dwWidth = in->dwWidth;
|
|
|
|
if(in->dwFlags & DDSD_HEIGHT) out->dwHeight = in->dwHeight;
|
2009-08-31 11:53:08 +02:00
|
|
|
if(in->dwFlags & DDSD_PIXELFORMAT) out->ddpfPixelFormat = in->u4.ddpfPixelFormat;
|
2009-01-09 12:23:17 +01:00
|
|
|
if(in->dwFlags & DDSD_CAPS) out->ddsCaps.dwCaps = in->ddsCaps.dwCaps;
|
2009-08-31 11:53:08 +02:00
|
|
|
if(in->dwFlags & DDSD_PITCH) out->u1.lPitch = in->u1.lPitch;
|
2015-02-28 09:22:59 +01:00
|
|
|
if(in->dwFlags & DDSD_BACKBUFFERCOUNT) out->dwBackBufferCount = in->u5.dwBackBufferCount;
|
2009-08-31 11:53:08 +02:00
|
|
|
if(in->dwFlags & DDSD_ZBUFFERBITDEPTH) out->u2.dwZBufferBitDepth = in->u2.dwMipMapCount; /* same union */
|
2009-01-09 12:23:17 +01:00
|
|
|
if(in->dwFlags & DDSD_ALPHABITDEPTH) out->dwAlphaBitDepth = in->dwAlphaBitDepth;
|
2008-12-18 15:40:55 +01:00
|
|
|
/* DDraw(native, and wine) does not set the DDSD_LPSURFACE, so always copy */
|
|
|
|
out->lpSurface = in->lpSurface;
|
2009-08-31 11:53:08 +02:00
|
|
|
if(in->dwFlags & DDSD_CKDESTOVERLAY) out->ddckCKDestOverlay = in->u3.ddckCKDestOverlay;
|
2009-01-09 12:23:17 +01:00
|
|
|
if(in->dwFlags & DDSD_CKDESTBLT) out->ddckCKDestBlt = in->ddckCKDestBlt;
|
|
|
|
if(in->dwFlags & DDSD_CKSRCOVERLAY) out->ddckCKSrcOverlay = in->ddckCKSrcOverlay;
|
|
|
|
if(in->dwFlags & DDSD_CKSRCBLT) out->ddckCKSrcBlt = in->ddckCKSrcBlt;
|
2009-08-31 11:53:08 +02:00
|
|
|
if(in->dwFlags & DDSD_MIPMAPCOUNT) out->u2.dwMipMapCount = in->u2.dwMipMapCount;
|
|
|
|
if(in->dwFlags & DDSD_REFRESHRATE) out->u2.dwRefreshRate = in->u2.dwRefreshRate;
|
|
|
|
if(in->dwFlags & DDSD_LINEARSIZE) out->u1.dwLinearSize = in->u1.dwLinearSize;
|
2009-01-09 12:23:17 +01:00
|
|
|
/* Does not exist in DDSURFACEDESC:
|
|
|
|
* DDSD_TEXTURESTAGE, DDSD_FVF, DDSD_SRCVBHANDLE,
|
|
|
|
*/
|
|
|
|
if(in->dwFlags & DDSD_TEXTURESTAGE) WARN("Does not exist in DDSURFACEDESC: DDSD_TEXTURESTAGE\n");
|
|
|
|
if(in->dwFlags & DDSD_FVF) WARN("Does not exist in DDSURFACEDESC: DDSD_FVF\n");
|
|
|
|
if(in->dwFlags & DDSD_SRCVBHANDLE) WARN("Does not exist in DDSURFACEDESC: DDSD_SRCVBHANDLE\n");
|
|
|
|
out->dwFlags &= ~(DDSD_TEXTURESTAGE | DDSD_FVF | DDSD_SRCVBHANDLE);
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_CreateSurface(IDirectDraw3 *iface, DDSURFACEDESC *desc,
|
|
|
|
IDirectDrawSurface **surface, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
DDSURFACEDESC2 ddsd2;
|
|
|
|
IDirectDrawSurface4 *surf4 = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, desc %p, surface %p, outer_unknown %p.\n",
|
|
|
|
iface, desc, surface, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
DDSD_to_DDSD2(desc, &ddsd2);
|
|
|
|
if (FAILED(hr = ddrawex4_CreateSurface(&ddrawex->IDirectDraw4_iface, &ddsd2, &surf4, outer_unknown)))
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
*surface = NULL;
|
2009-01-09 12:23:17 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2008-12-18 15:40:55 +01:00
|
|
|
TRACE("Got surface %p\n", surf4);
|
2013-11-12 11:00:28 +01:00
|
|
|
IDirectDrawSurface4_QueryInterface(surf4, &IID_IDirectDrawSurface, (void **)surface);
|
2009-01-09 12:23:17 +01:00
|
|
|
IDirectDrawSurface4_Release(surf4);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_CreateSurface(IDirectDraw2 *iface, DDSURFACEDESC *desc,
|
|
|
|
IDirectDrawSurface **surface, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, desc %p, surface %p, outer_unknown %p.\n",
|
|
|
|
iface, desc, surface, outer_unknown);
|
|
|
|
|
|
|
|
return ddrawex3_CreateSurface(&ddrawex->IDirectDraw3_iface, desc, surface, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_CreateSurface(IDirectDraw *iface, DDSURFACEDESC *desc,
|
|
|
|
IDirectDrawSurface **surface, IUnknown *outer_unknown)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, desc %p, surface %p, outer_unknown %p.\n",
|
|
|
|
iface, desc, surface, outer_unknown);
|
|
|
|
|
|
|
|
return ddrawex3_CreateSurface(&ddrawex->IDirectDraw3_iface, desc, surface, outer_unknown);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_DuplicateSurface(IDirectDraw4 *iface,
|
2011-01-23 21:44:35 +01:00
|
|
|
IDirectDrawSurface4 *src, IDirectDrawSurface4 **dst)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
2013-11-12 11:00:29 +01:00
|
|
|
struct ddrawex_surface *src_impl = unsafe_impl_from_IDirectDrawSurface4(src);
|
2012-08-17 16:07:56 +02:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
|
|
|
|
FIXME("Create a wrapper surface.\n");
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
return IDirectDraw4_DuplicateSurface(ddrawex->parent, src_impl ? src_impl->parent : NULL, dst);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_DuplicateSurface(IDirectDraw3 *iface,
|
2011-01-23 21:13:49 +01:00
|
|
|
IDirectDrawSurface *src, IDirectDrawSurface **dst)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
IDirectDrawSurface4 *src_4;
|
|
|
|
IDirectDrawSurface4 *dst_4;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
IDirectDrawSurface_QueryInterface(src, &IID_IDirectDrawSurface4, (void **)&src_4);
|
|
|
|
hr = ddrawex4_DuplicateSurface(&ddrawex->IDirectDraw4_iface, src_4, &dst_4);
|
|
|
|
IDirectDrawSurface4_Release(src_4);
|
|
|
|
if (FAILED(hr))
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
|
|
|
*dst = NULL;
|
|
|
|
return hr;
|
|
|
|
}
|
2013-11-12 11:00:28 +01:00
|
|
|
|
|
|
|
IDirectDrawSurface4_QueryInterface(dst_4, &IID_IDirectDrawSurface, (void **)dst);
|
2009-01-09 12:23:17 +01:00
|
|
|
IDirectDrawSurface4_Release(dst_4);
|
2013-11-12 11:00:28 +01:00
|
|
|
|
2009-01-09 12:23:17 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_DuplicateSurface(IDirectDraw2 *iface,
|
2011-01-23 21:05:51 +01:00
|
|
|
IDirectDrawSurface *src, IDirectDrawSurface **dst)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
|
|
|
|
|
|
|
|
return ddrawex3_DuplicateSurface(&ddrawex->IDirectDraw3_iface, src, dst);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_DuplicateSurface(IDirectDraw *iface,
|
|
|
|
IDirectDrawSurface *src, IDirectDrawSurface **dst)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
|
|
|
|
|
|
|
|
return ddrawex3_DuplicateSurface(&ddrawex->IDirectDraw3_iface, src, dst);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_EnumDisplayModes(IDirectDraw4 *iface, DWORD flags,
|
|
|
|
DDSURFACEDESC2 *desc, void *ctx, LPDDENUMMODESCALLBACK2 cb)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, desc %p, ctx %p, cb %p.\n", iface, flags, desc, ctx, cb);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
return IDirectDraw4_EnumDisplayModes(ddrawex->parent, flags, desc, ctx, cb);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct enummodes_ctx
|
|
|
|
{
|
|
|
|
LPDDENUMMODESCALLBACK orig_cb;
|
|
|
|
void *orig_ctx;
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
enum_modes_cb2(DDSURFACEDESC2 *ddsd2, void *vctx)
|
|
|
|
{
|
2009-01-14 09:52:06 +01:00
|
|
|
struct enummodes_ctx *ctx = vctx;
|
2009-01-09 12:23:17 +01:00
|
|
|
DDSURFACEDESC ddsd;
|
|
|
|
|
|
|
|
DDSD2_to_DDSD(ddsd2, &ddsd);
|
|
|
|
return ctx->orig_cb(&ddsd, ctx->orig_ctx);
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_EnumDisplayModes(IDirectDraw3 *iface, DWORD flags,
|
|
|
|
DDSURFACEDESC *desc, void *ctx, LPDDENUMMODESCALLBACK cb)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
struct enummodes_ctx cb_ctx;
|
2009-01-09 12:23:17 +01:00
|
|
|
DDSURFACEDESC2 ddsd2;
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, flags %#x, desc %p, ctx %p, cb %p.\n", iface, flags, desc, ctx, cb);
|
|
|
|
|
|
|
|
DDSD_to_DDSD2(desc, &ddsd2);
|
|
|
|
cb_ctx.orig_cb = cb;
|
|
|
|
cb_ctx.orig_ctx = ctx;
|
|
|
|
return ddrawex4_EnumDisplayModes(&ddrawex->IDirectDraw4_iface, flags, &ddsd2, &cb_ctx, enum_modes_cb2);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_EnumDisplayModes(IDirectDraw2 *iface, DWORD flags,
|
|
|
|
DDSURFACEDESC *desc, void *ctx, LPDDENUMMODESCALLBACK cb)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, desc %p, ctx %p, cb %p.\n", iface, flags, desc, ctx, cb);
|
|
|
|
|
|
|
|
return ddrawex3_EnumDisplayModes(&ddrawex->IDirectDraw3_iface, flags, desc, ctx, cb);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_EnumDisplayModes(IDirectDraw *iface, DWORD flags,
|
|
|
|
DDSURFACEDESC *desc, void *ctx, LPDDENUMMODESCALLBACK cb)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, desc %p, ctx %p, cb %p.\n", iface, flags, desc, ctx, cb);
|
|
|
|
|
|
|
|
return ddrawex3_EnumDisplayModes(&ddrawex->IDirectDraw3_iface, flags, desc, ctx, cb);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2008-12-18 15:40:55 +01:00
|
|
|
struct enumsurfaces4_ctx
|
|
|
|
{
|
|
|
|
LPDDENUMSURFACESCALLBACK2 orig_cb;
|
|
|
|
void *orig_ctx;
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
enum_surfaces_wrapper(IDirectDrawSurface4 *surf4, DDSURFACEDESC2 *ddsd2, void *vctx)
|
|
|
|
{
|
2009-01-14 09:52:06 +01:00
|
|
|
struct enumsurfaces4_ctx *ctx = vctx;
|
2008-12-18 15:40:55 +01:00
|
|
|
IDirectDrawSurface4 *outer = dds_get_outer(surf4);
|
|
|
|
IDirectDrawSurface4_AddRef(outer);
|
|
|
|
IDirectDrawSurface4_Release(surf4);
|
|
|
|
TRACE("Returning wrapper surface %p for enumerated inner surface %p\n", outer, surf4);
|
|
|
|
return ctx->orig_cb(outer, ddsd2, ctx->orig_ctx);
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_EnumSurfaces(IDirectDraw4 *iface, DWORD flags,
|
|
|
|
DDSURFACEDESC2 *desc, void *ctx, LPDDENUMSURFACESCALLBACK2 cb)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
struct enumsurfaces4_ctx cb_ctx;
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, flags %#x, desc %p, ctx %p, cb %p.\n", iface, flags, desc, ctx, cb);
|
|
|
|
|
|
|
|
cb_ctx.orig_cb = cb;
|
|
|
|
cb_ctx.orig_ctx = ctx;
|
|
|
|
return IDirectDraw4_EnumSurfaces(ddrawex->parent, flags, desc, &cb_ctx, enum_surfaces_wrapper);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct enumsurfaces_ctx
|
|
|
|
{
|
|
|
|
LPDDENUMSURFACESCALLBACK orig_cb;
|
|
|
|
void *orig_ctx;
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
enum_surfaces_cb2(IDirectDrawSurface4 *surf4, DDSURFACEDESC2 *ddsd2, void *vctx)
|
|
|
|
{
|
2009-01-14 09:52:06 +01:00
|
|
|
struct enumsurfaces_ctx *ctx = vctx;
|
2009-01-09 12:23:17 +01:00
|
|
|
IDirectDrawSurface *surf1;
|
|
|
|
DDSURFACEDESC ddsd;
|
|
|
|
|
|
|
|
/* Keep the reference, it goes to the application */
|
|
|
|
IDirectDrawSurface4_QueryInterface(surf4, &IID_IDirectDrawSurface, (void **) &surf1);
|
|
|
|
/* Release the reference this function got */
|
|
|
|
IDirectDrawSurface4_Release(surf4);
|
|
|
|
|
|
|
|
DDSD2_to_DDSD(ddsd2, &ddsd);
|
|
|
|
return ctx->orig_cb(surf1, &ddsd, ctx->orig_ctx);
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_EnumSurfaces(IDirectDraw3 *iface, DWORD flags,
|
|
|
|
DDSURFACEDESC *desc, void *ctx, LPDDENUMSURFACESCALLBACK cb)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
DDSURFACEDESC2 ddsd2;
|
2013-11-12 11:00:28 +01:00
|
|
|
struct enumsurfaces_ctx cb_ctx;
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, desc %p, ctx %p, cb %p.\n", iface, flags, desc, ctx, cb);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
DDSD_to_DDSD2(desc, &ddsd2);
|
|
|
|
cb_ctx.orig_cb = cb;
|
|
|
|
cb_ctx.orig_ctx = ctx;
|
|
|
|
return ddrawex4_EnumSurfaces(&ddrawex->IDirectDraw4_iface, flags, &ddsd2, &cb_ctx, enum_surfaces_cb2);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_EnumSurfaces(IDirectDraw2 *iface, DWORD flags,
|
|
|
|
DDSURFACEDESC *desc, void *ctx, LPDDENUMSURFACESCALLBACK cb)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, desc %p, ctx %p, cb %p.\n", iface, flags, desc, ctx, cb);
|
|
|
|
|
|
|
|
return ddrawex3_EnumSurfaces(&ddrawex->IDirectDraw3_iface, flags, desc, ctx, cb);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_EnumSurfaces(IDirectDraw *iface, DWORD flags,
|
|
|
|
DDSURFACEDESC *desc, void *ctx, LPDDENUMSURFACESCALLBACK cb)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, desc %p, ctx %p, cb %p.\n", iface, flags, desc, ctx, cb);
|
|
|
|
|
|
|
|
return ddrawex3_EnumSurfaces(&ddrawex->IDirectDraw3_iface, flags, desc, ctx, cb);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_FlipToGDISurface(IDirectDraw4 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return IDirectDraw4_FlipToGDISurface(ddrawex->parent);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_FlipToGDISurface(IDirectDraw3 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_FlipToGDISurface(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_FlipToGDISurface(IDirectDraw2 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_FlipToGDISurface(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_FlipToGDISurface(IDirectDraw *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_FlipToGDISurface(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_GetCaps(IDirectDraw4 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps);
|
|
|
|
|
|
|
|
return IDirectDraw4_GetCaps(ddrawex->parent, driver_caps, hel_caps);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_GetCaps(IDirectDraw3 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps);
|
|
|
|
|
|
|
|
return ddrawex4_GetCaps(&ddrawex->IDirectDraw4_iface, driver_caps, hel_caps);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_GetCaps(IDirectDraw2 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps);
|
|
|
|
|
|
|
|
return ddrawex4_GetCaps(&ddrawex->IDirectDraw4_iface, driver_caps, hel_caps);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_GetCaps(IDirectDraw *iface, DDCAPS *driver_caps, DDCAPS *hel_caps)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps);
|
|
|
|
|
|
|
|
return ddrawex4_GetCaps(&ddrawex->IDirectDraw4_iface, driver_caps, hel_caps);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_GetDisplayMode(IDirectDraw4 *iface, DDSURFACEDESC2 *desc)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, desc %p.\n", iface, desc);
|
|
|
|
|
|
|
|
return IDirectDraw4_GetDisplayMode(ddrawex->parent, desc);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_GetDisplayMode(IDirectDraw3 *iface, DDSURFACEDESC *desc)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
DDSURFACEDESC2 ddsd2;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, desc %p.\n", iface, desc);
|
|
|
|
|
|
|
|
hr = ddrawex4_GetDisplayMode(&ddrawex->IDirectDraw4_iface, &ddsd2);
|
|
|
|
DDSD2_to_DDSD(&ddsd2, desc);
|
|
|
|
|
2009-01-09 12:23:17 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_GetDisplayMode(IDirectDraw2 *iface, DDSURFACEDESC *desc)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, desc %p.\n", iface, desc);
|
|
|
|
|
|
|
|
return ddrawex3_GetDisplayMode(&ddrawex->IDirectDraw3_iface, desc);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_GetDisplayMode(IDirectDraw *iface, DDSURFACEDESC *desc)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, desc %p.\n", iface, desc);
|
|
|
|
|
|
|
|
return ddrawex3_GetDisplayMode(&ddrawex->IDirectDraw3_iface, desc);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_GetFourCCCodes(IDirectDraw4 *iface, DWORD *code_count, DWORD *codes)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, code_count %p, codes %p.\n", iface, code_count, codes);
|
|
|
|
|
|
|
|
return IDirectDraw4_GetFourCCCodes(ddrawex->parent, code_count, codes);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_GetFourCCCodes(IDirectDraw3 *iface, DWORD *code_count, DWORD *codes)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, code_count %p, codes %p.\n", iface, code_count, codes);
|
|
|
|
|
|
|
|
return ddrawex4_GetFourCCCodes(&ddrawex->IDirectDraw4_iface, code_count, codes);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_GetFourCCCodes(IDirectDraw2 *iface, DWORD *code_count, DWORD *codes)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, code_count %p, codes %p.\n", iface, code_count, codes);
|
|
|
|
|
|
|
|
return ddrawex4_GetFourCCCodes(&ddrawex->IDirectDraw4_iface, code_count, codes);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_GetFourCCCodes(IDirectDraw *iface, DWORD *code_count, DWORD *codes)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, code_count %p, codes %p.\n", iface, code_count, codes);
|
|
|
|
|
|
|
|
return ddrawex4_GetFourCCCodes(&ddrawex->IDirectDraw4_iface, code_count, codes);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_GetGDISurface(IDirectDraw4 *iface, IDirectDrawSurface4 **gdi_surface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
2008-12-18 15:40:55 +01:00
|
|
|
IDirectDrawSurface4 *inner = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, gdi_surface %p.\n", iface, gdi_surface);
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirectDraw4_GetGDISurface(ddrawex->parent, &inner)))
|
2008-12-18 15:40:55 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
*gdi_surface = NULL;
|
|
|
|
return hr;
|
2008-12-18 15:40:55 +01:00
|
|
|
}
|
2013-11-12 11:00:28 +01:00
|
|
|
|
|
|
|
*gdi_surface = dds_get_outer(inner);
|
|
|
|
IDirectDrawSurface4_AddRef(*gdi_surface);
|
|
|
|
IDirectDrawSurface4_Release(inner);
|
2008-12-18 15:40:55 +01:00
|
|
|
return hr;
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_GetGDISurface(IDirectDraw3 *iface, IDirectDrawSurface **gdi_surface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
IDirectDrawSurface4 *surf4;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, gdi_surface %p.\n", iface, gdi_surface);
|
|
|
|
|
|
|
|
if (FAILED(hr = ddrawex4_GetGDISurface(&ddrawex->IDirectDraw4_iface, &surf4)))
|
|
|
|
{
|
|
|
|
*gdi_surface = NULL;
|
2009-01-09 12:23:17 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
IDirectDrawSurface4_QueryInterface(surf4, &IID_IDirectDrawSurface, (void **)gdi_surface);
|
2009-01-09 12:23:17 +01:00
|
|
|
IDirectDrawSurface4_Release(surf4);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_GetGDISurface(IDirectDraw2 *iface, IDirectDrawSurface **gdi_surface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, gdi_surface %p.\n", iface, gdi_surface);
|
|
|
|
|
|
|
|
return ddrawex3_GetGDISurface(&ddrawex->IDirectDraw3_iface, gdi_surface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_GetGDISurface(IDirectDraw *iface, IDirectDrawSurface **gdi_surface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, gdi_surface %p.\n", iface, gdi_surface);
|
|
|
|
|
|
|
|
return ddrawex3_GetGDISurface(&ddrawex->IDirectDraw3_iface, gdi_surface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_GetMonitorFrequency(IDirectDraw4 *iface, DWORD *frequency)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, frequency %p.\n", iface, frequency);
|
|
|
|
|
|
|
|
return IDirectDraw4_GetMonitorFrequency(ddrawex->parent, frequency);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_GetMonitorFrequency(IDirectDraw3 *iface, DWORD *frequency)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, frequency %p.\n", iface, frequency);
|
|
|
|
|
|
|
|
return ddrawex4_GetMonitorFrequency(&ddrawex->IDirectDraw4_iface, frequency);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_GetMonitorFrequency(IDirectDraw2 *iface, DWORD *frequency)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, frequency %p.\n", iface, frequency);
|
|
|
|
|
|
|
|
return ddrawex4_GetMonitorFrequency(&ddrawex->IDirectDraw4_iface, frequency);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_GetMonitorFrequency(IDirectDraw *iface, DWORD *frequency)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, frequency %p.\n", iface, frequency);
|
|
|
|
|
|
|
|
return ddrawex4_GetMonitorFrequency(&ddrawex->IDirectDraw4_iface, frequency);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_GetScanLine(IDirectDraw4 *iface, DWORD *line)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, line %p.\n", iface, line);
|
|
|
|
|
|
|
|
return IDirectDraw4_GetScanLine(ddrawex->parent, line);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_GetScanLine(IDirectDraw3 *iface, DWORD *line)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, line %p.\n", iface, line);
|
|
|
|
|
|
|
|
return ddrawex4_GetScanLine(&ddrawex->IDirectDraw4_iface, line);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_GetScanLine(IDirectDraw2 *iface, DWORD *line)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, line %p.\n", iface, line);
|
|
|
|
|
|
|
|
return ddrawex4_GetScanLine(&ddrawex->IDirectDraw4_iface, line);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_GetScanLine(IDirectDraw *iface, DWORD *line)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, line %p.\n", iface, line);
|
|
|
|
|
|
|
|
return ddrawex4_GetScanLine(&ddrawex->IDirectDraw4_iface, line);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_GetVerticalBlankStatus(IDirectDraw4 *iface, BOOL *status)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, status %p.\n", iface, status);
|
|
|
|
|
|
|
|
return IDirectDraw4_GetVerticalBlankStatus(ddrawex->parent, status);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_GetVerticalBlankStatus(IDirectDraw3 *iface, BOOL *status)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, status %p.\n", iface, status);
|
|
|
|
|
|
|
|
return ddrawex4_GetVerticalBlankStatus(&ddrawex->IDirectDraw4_iface, status);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_GetVerticalBlankStatus(IDirectDraw2 *iface, BOOL *status)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, status %p.\n", iface, status);
|
|
|
|
|
|
|
|
return ddrawex4_GetVerticalBlankStatus(&ddrawex->IDirectDraw4_iface, status);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_GetVerticalBlankStatus(IDirectDraw *iface, BOOL *status)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, status %p.\n", iface, status);
|
|
|
|
|
|
|
|
return ddrawex4_GetVerticalBlankStatus(&ddrawex->IDirectDraw4_iface, status);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_Initialize(IDirectDraw4 *iface, GUID *guid)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
|
|
|
|
|
|
|
|
return IDirectDraw4_Initialize(ddrawex->parent, guid);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_Initialize(IDirectDraw3 *iface, GUID *guid)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
|
|
|
|
|
|
|
|
return ddrawex4_Initialize(&ddrawex->IDirectDraw4_iface, guid);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_Initialize(IDirectDraw2 *iface, GUID *guid)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
|
|
|
|
|
|
|
|
return ddrawex4_Initialize(&ddrawex->IDirectDraw4_iface, guid);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_Initialize(IDirectDraw *iface, GUID *guid)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
|
|
|
|
|
|
|
|
return ddrawex4_Initialize(&ddrawex->IDirectDraw4_iface, guid);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_RestoreDisplayMode(IDirectDraw4 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return IDirectDraw4_RestoreDisplayMode(ddrawex->parent);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_RestoreDisplayMode(IDirectDraw3 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_RestoreDisplayMode(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_RestoreDisplayMode(IDirectDraw2 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_RestoreDisplayMode(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_RestoreDisplayMode(IDirectDraw *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return ddrawex4_RestoreDisplayMode(&ddrawex->IDirectDraw4_iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_SetCooperativeLevel(IDirectDraw4 *iface, HWND window, DWORD flags)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
|
|
|
|
|
|
|
|
return IDirectDraw4_SetCooperativeLevel(ddrawex->parent, window, flags);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_SetCooperativeLevel(IDirectDraw3 *iface, HWND window, DWORD flags)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
|
|
|
|
|
|
|
|
return ddrawex4_SetCooperativeLevel(&ddrawex->IDirectDraw4_iface, window, flags);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_SetCooperativeLevel(IDirectDraw2 *iface, HWND window, DWORD flags)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
|
|
|
|
|
|
|
|
return ddrawex4_SetCooperativeLevel(&ddrawex->IDirectDraw4_iface, window, flags);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_SetCooperativeLevel(IDirectDraw *iface, HWND window, DWORD flags)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
|
|
|
|
|
|
|
|
return ddrawex4_SetCooperativeLevel(&ddrawex->IDirectDraw4_iface, window, flags);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_SetDisplayMode(IDirectDraw4 *iface, DWORD width,
|
|
|
|
DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags)
|
2011-01-23 21:44:35 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n",
|
|
|
|
iface, width, height, bpp, refresh_rate, flags);
|
|
|
|
|
|
|
|
return IDirectDraw4_SetDisplayMode(ddrawex->parent, width, height, bpp, refresh_rate, flags);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_SetDisplayMode(IDirectDraw3 *iface, DWORD width,
|
|
|
|
DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n",
|
|
|
|
iface, width, height, bpp, refresh_rate, flags);
|
|
|
|
|
|
|
|
return ddrawex4_SetDisplayMode(&ddrawex->IDirectDraw4_iface, width, height, bpp, refresh_rate, flags);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_SetDisplayMode(IDirectDraw2 *iface, DWORD width,
|
|
|
|
DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n",
|
|
|
|
iface, width, height, bpp, refresh_rate, flags);
|
|
|
|
|
|
|
|
return ddrawex4_SetDisplayMode(&ddrawex->IDirectDraw4_iface, width, height, bpp, refresh_rate, flags);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_SetDisplayMode(IDirectDraw *iface, DWORD width,
|
|
|
|
DWORD height, DWORD bpp)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, width %u, height %u, bpp %u.\n", iface, width, height, bpp);
|
|
|
|
|
|
|
|
return ddrawex4_SetDisplayMode(&ddrawex->IDirectDraw4_iface, width, height, bpp, 0, 0);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_WaitForVerticalBlank(IDirectDraw4 *iface, DWORD flags, HANDLE event)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event);
|
|
|
|
|
|
|
|
return IDirectDraw4_WaitForVerticalBlank(ddrawex->parent, flags, event);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_WaitForVerticalBlank(IDirectDraw3 *iface, DWORD flags, HANDLE event)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event);
|
|
|
|
|
|
|
|
return ddrawex4_WaitForVerticalBlank(&ddrawex->IDirectDraw4_iface, flags, event);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_WaitForVerticalBlank(IDirectDraw2 *iface, DWORD flags, HANDLE event)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event);
|
|
|
|
|
|
|
|
return ddrawex4_WaitForVerticalBlank(&ddrawex->IDirectDraw4_iface, flags, event);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex1_WaitForVerticalBlank(IDirectDraw *iface, DWORD flags, HANDLE event)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event);
|
|
|
|
|
|
|
|
return ddrawex4_WaitForVerticalBlank(&ddrawex->IDirectDraw4_iface, flags, event);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_GetAvailableVidMem(IDirectDraw4 *iface,
|
|
|
|
DDSCAPS2 *caps, DWORD *total, DWORD *free)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free);
|
|
|
|
|
|
|
|
return IDirectDraw4_GetAvailableVidMem(ddrawex->parent, caps, total, free);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_GetAvailableVidMem(IDirectDraw3 *iface,
|
|
|
|
DDSCAPS *caps, DWORD *total, DWORD *free)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
DDSCAPS2 caps2;
|
2013-11-12 11:00:28 +01:00
|
|
|
|
|
|
|
TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free);
|
|
|
|
|
2009-01-09 12:23:17 +01:00
|
|
|
memset(&caps2, 0, sizeof(caps2));
|
2013-11-12 11:00:28 +01:00
|
|
|
caps2.dwCaps = caps->dwCaps;
|
|
|
|
return ddrawex4_GetAvailableVidMem(&ddrawex->IDirectDraw4_iface, &caps2, total, free);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex2_GetAvailableVidMem(IDirectDraw2 *iface,
|
|
|
|
DDSCAPS *caps, DWORD *total, DWORD *free)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw2(iface);
|
2009-01-09 12:23:17 +01:00
|
|
|
DDSCAPS2 caps2;
|
2013-11-12 11:00:28 +01:00
|
|
|
|
|
|
|
TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free);
|
|
|
|
|
2009-01-09 12:23:17 +01:00
|
|
|
memset(&caps2, 0, sizeof(caps2));
|
2013-11-12 11:00:28 +01:00
|
|
|
caps2.dwCaps = caps->dwCaps;
|
|
|
|
return ddrawex4_GetAvailableVidMem(&ddrawex->IDirectDraw4_iface, &caps2, total, free);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_GetSurfaceFromDC(IDirectDraw4 *iface,
|
|
|
|
HDC dc, IDirectDrawSurface4 **surface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
2008-12-18 15:40:55 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, dc %p, surface %p.\n", iface, dc, surface);
|
|
|
|
|
|
|
|
return IDirectDraw4_GetSurfaceFromDC(ddrawex->parent, dc, surface);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex3_GetSurfaceFromDC(IDirectDraw3 *iface,
|
|
|
|
HDC dc, IDirectDrawSurface **surface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw3(iface);
|
2010-03-29 13:31:09 +02:00
|
|
|
IDirectDrawSurface4 *surf4, *outer;
|
|
|
|
IDirectDrawSurface *inner;
|
2009-01-09 12:23:17 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, dc %p, surface %p.\n", iface, dc, surface);
|
2010-03-29 13:31:09 +02:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
if (!surface)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirectDraw4_GetSurfaceFromDC(ddrawex->parent, dc, (IDirectDrawSurface4 **)&inner)))
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
*surface = NULL;
|
2009-01-09 12:23:17 +01:00
|
|
|
return hr;
|
|
|
|
}
|
2010-03-29 13:31:09 +02:00
|
|
|
|
|
|
|
hr = IDirectDrawSurface_QueryInterface(inner, &IID_IDirectDrawSurface4, (void **)&surf4);
|
|
|
|
IDirectDrawSurface_Release(inner);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
*surface = NULL;
|
2010-03-29 13:31:09 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
outer = dds_get_outer(surf4);
|
2013-11-12 11:00:28 +01:00
|
|
|
hr = IDirectDrawSurface4_QueryInterface(outer, &IID_IDirectDrawSurface, (void **)surface);
|
2009-01-09 12:23:17 +01:00
|
|
|
IDirectDrawSurface4_Release(surf4);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_RestoreAllSurfaces(IDirectDraw4 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return IDirectDraw4_RestoreAllSurfaces(ddrawex->parent);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_TestCooperativeLevel(IDirectDraw4 *iface)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return IDirectDraw4_TestCooperativeLevel(ddrawex->parent);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static HRESULT WINAPI ddrawex4_GetDeviceIdentifier(IDirectDraw4 *iface,
|
|
|
|
DDDEVICEIDENTIFIER *identifier, DWORD flags)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, identifier %p, flags %#x.\n", iface, identifier, flags);
|
|
|
|
|
|
|
|
return IDirectDraw4_GetDeviceIdentifier(ddrawex->parent, identifier, flags);
|
2009-01-09 12:23:17 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static const IDirectDraw4Vtbl ddrawex4_vtbl =
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
ddrawex4_QueryInterface,
|
|
|
|
ddrawex4_AddRef,
|
|
|
|
ddrawex4_Release,
|
|
|
|
ddrawex4_Compact,
|
|
|
|
ddrawex4_CreateClipper,
|
|
|
|
ddrawex4_CreatePalette,
|
|
|
|
ddrawex4_CreateSurface,
|
|
|
|
ddrawex4_DuplicateSurface,
|
|
|
|
ddrawex4_EnumDisplayModes,
|
|
|
|
ddrawex4_EnumSurfaces,
|
|
|
|
ddrawex4_FlipToGDISurface,
|
|
|
|
ddrawex4_GetCaps,
|
|
|
|
ddrawex4_GetDisplayMode,
|
|
|
|
ddrawex4_GetFourCCCodes,
|
|
|
|
ddrawex4_GetGDISurface,
|
|
|
|
ddrawex4_GetMonitorFrequency,
|
|
|
|
ddrawex4_GetScanLine,
|
|
|
|
ddrawex4_GetVerticalBlankStatus,
|
|
|
|
ddrawex4_Initialize,
|
|
|
|
ddrawex4_RestoreDisplayMode,
|
|
|
|
ddrawex4_SetCooperativeLevel,
|
|
|
|
ddrawex4_SetDisplayMode,
|
|
|
|
ddrawex4_WaitForVerticalBlank,
|
|
|
|
ddrawex4_GetAvailableVidMem,
|
|
|
|
ddrawex4_GetSurfaceFromDC,
|
|
|
|
ddrawex4_RestoreAllSurfaces,
|
|
|
|
ddrawex4_TestCooperativeLevel,
|
|
|
|
ddrawex4_GetDeviceIdentifier,
|
2009-01-09 12:23:17 +01:00
|
|
|
};
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static const IDirectDraw3Vtbl ddrawex3_vtbl =
|
|
|
|
{
|
|
|
|
ddrawex3_QueryInterface,
|
|
|
|
ddrawex3_AddRef,
|
|
|
|
ddrawex3_Release,
|
|
|
|
ddrawex3_Compact,
|
|
|
|
ddrawex3_CreateClipper,
|
|
|
|
ddrawex3_CreatePalette,
|
|
|
|
ddrawex3_CreateSurface,
|
|
|
|
ddrawex3_DuplicateSurface,
|
|
|
|
ddrawex3_EnumDisplayModes,
|
|
|
|
ddrawex3_EnumSurfaces,
|
|
|
|
ddrawex3_FlipToGDISurface,
|
|
|
|
ddrawex3_GetCaps,
|
|
|
|
ddrawex3_GetDisplayMode,
|
|
|
|
ddrawex3_GetFourCCCodes,
|
|
|
|
ddrawex3_GetGDISurface,
|
|
|
|
ddrawex3_GetMonitorFrequency,
|
|
|
|
ddrawex3_GetScanLine,
|
|
|
|
ddrawex3_GetVerticalBlankStatus,
|
|
|
|
ddrawex3_Initialize,
|
|
|
|
ddrawex3_RestoreDisplayMode,
|
|
|
|
ddrawex3_SetCooperativeLevel,
|
|
|
|
ddrawex3_SetDisplayMode,
|
|
|
|
ddrawex3_WaitForVerticalBlank,
|
|
|
|
ddrawex3_GetAvailableVidMem,
|
|
|
|
ddrawex3_GetSurfaceFromDC,
|
2009-01-09 12:23:17 +01:00
|
|
|
};
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static const IDirectDraw2Vtbl ddrawex2_vtbl =
|
|
|
|
{
|
|
|
|
ddrawex2_QueryInterface,
|
|
|
|
ddrawex2_AddRef,
|
|
|
|
ddrawex2_Release,
|
|
|
|
ddrawex2_Compact,
|
|
|
|
ddrawex2_CreateClipper,
|
|
|
|
ddrawex2_CreatePalette,
|
|
|
|
ddrawex2_CreateSurface,
|
|
|
|
ddrawex2_DuplicateSurface,
|
|
|
|
ddrawex2_EnumDisplayModes,
|
|
|
|
ddrawex2_EnumSurfaces,
|
|
|
|
ddrawex2_FlipToGDISurface,
|
|
|
|
ddrawex2_GetCaps,
|
|
|
|
ddrawex2_GetDisplayMode,
|
|
|
|
ddrawex2_GetFourCCCodes,
|
|
|
|
ddrawex2_GetGDISurface,
|
|
|
|
ddrawex2_GetMonitorFrequency,
|
|
|
|
ddrawex2_GetScanLine,
|
|
|
|
ddrawex2_GetVerticalBlankStatus,
|
|
|
|
ddrawex2_Initialize,
|
|
|
|
ddrawex2_RestoreDisplayMode,
|
|
|
|
ddrawex2_SetCooperativeLevel,
|
|
|
|
ddrawex2_SetDisplayMode,
|
|
|
|
ddrawex2_WaitForVerticalBlank,
|
|
|
|
ddrawex2_GetAvailableVidMem,
|
2009-01-09 12:23:17 +01:00
|
|
|
};
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
static const IDirectDrawVtbl ddrawex1_vtbl =
|
|
|
|
{
|
|
|
|
ddrawex1_QueryInterface,
|
|
|
|
ddrawex1_AddRef,
|
|
|
|
ddrawex1_Release,
|
|
|
|
ddrawex1_Compact,
|
|
|
|
ddrawex1_CreateClipper,
|
|
|
|
ddrawex1_CreatePalette,
|
|
|
|
ddrawex1_CreateSurface,
|
|
|
|
ddrawex1_DuplicateSurface,
|
|
|
|
ddrawex1_EnumDisplayModes,
|
|
|
|
ddrawex1_EnumSurfaces,
|
|
|
|
ddrawex1_FlipToGDISurface,
|
|
|
|
ddrawex1_GetCaps,
|
|
|
|
ddrawex1_GetDisplayMode,
|
|
|
|
ddrawex1_GetFourCCCodes,
|
|
|
|
ddrawex1_GetGDISurface,
|
|
|
|
ddrawex1_GetMonitorFrequency,
|
|
|
|
ddrawex1_GetScanLine,
|
|
|
|
ddrawex1_GetVerticalBlankStatus,
|
|
|
|
ddrawex1_Initialize,
|
|
|
|
ddrawex1_RestoreDisplayMode,
|
|
|
|
ddrawex1_SetCooperativeLevel,
|
|
|
|
ddrawex1_SetDisplayMode,
|
|
|
|
ddrawex1_WaitForVerticalBlank,
|
2009-01-09 12:23:17 +01:00
|
|
|
};
|
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
HRESULT WINAPI ddrawex_factory_CreateDirectDraw(IDirectDrawFactory *iface, GUID *guid, HWND window,
|
|
|
|
DWORD coop_level, DWORD reserved, IUnknown *outer_unknown, IDirectDraw **ddraw)
|
2009-01-09 12:23:17 +01:00
|
|
|
{
|
|
|
|
IDirectDraw *parent = NULL;
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *object;
|
|
|
|
HRESULT hr;
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
TRACE("iface %p, guid %s, window %p, coop_level %#x, reserved %#x, outer_unknown %p, ddraw %p.\n",
|
|
|
|
iface, debugstr_guid(guid), window, coop_level, reserved, outer_unknown, ddraw);
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
if (outer_unknown)
|
|
|
|
FIXME("Implement aggregation in ddrawex's IDirectDraw interface.\n");
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
|
|
|
|
return E_OUTOFMEMORY;
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
object->ref = 1;
|
|
|
|
object->IDirectDraw_iface.lpVtbl = &ddrawex1_vtbl;
|
|
|
|
object->IDirectDraw2_iface.lpVtbl = &ddrawex2_vtbl;
|
|
|
|
object->IDirectDraw3_iface.lpVtbl = &ddrawex3_vtbl;
|
|
|
|
object->IDirectDraw4_iface.lpVtbl = &ddrawex4_vtbl;
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
if (FAILED(hr = DirectDrawCreate(guid, &parent, NULL)))
|
|
|
|
goto err;
|
|
|
|
if (FAILED(hr = IDirectDraw_QueryInterface(parent, &IID_IDirectDraw4, (void **)&object->parent)))
|
|
|
|
goto err;
|
|
|
|
if (FAILED(hr = IDirectDraw_SetCooperativeLevel(&object->IDirectDraw_iface, window, coop_level)))
|
|
|
|
goto err;
|
2009-01-09 12:23:17 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
*ddraw = &object->IDirectDraw_iface;
|
2009-01-09 12:23:17 +01:00
|
|
|
IDirectDraw_Release(parent);
|
|
|
|
return DD_OK;
|
|
|
|
|
|
|
|
err:
|
|
|
|
if(object && object->parent) IDirectDraw4_Release(object->parent);
|
|
|
|
if(parent) IDirectDraw_Release(parent);
|
2009-01-10 02:43:44 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
2013-11-12 11:00:28 +01:00
|
|
|
*ddraw = NULL;
|
2009-01-09 12:23:17 +01:00
|
|
|
return hr;
|
|
|
|
}
|
2008-12-18 15:40:55 +01:00
|
|
|
|
|
|
|
IDirectDraw4 *dd_get_inner(IDirectDraw4 *outer)
|
|
|
|
{
|
2013-11-12 11:00:28 +01:00
|
|
|
struct ddrawex *ddrawex = impl_from_IDirectDraw4(outer);
|
2011-01-23 21:48:10 +01:00
|
|
|
|
2013-11-12 11:00:28 +01:00
|
|
|
if (outer->lpVtbl != &ddrawex4_vtbl)
|
|
|
|
return NULL;
|
|
|
|
return ddrawex->parent;
|
2008-12-18 15:40:55 +01:00
|
|
|
}
|