wined3d: Remove IWineD3DDevice::EnumDisplayModes.
This commit is contained in:
parent
7676462a3d
commit
27113156d9
|
@ -1135,50 +1135,6 @@ IDirectDrawImpl_GetGDISurface(IDirectDraw7 *iface,
|
|||
return hr;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectDrawImpl_EnumDisplayModesCB
|
||||
*
|
||||
* Callback function for IDirectDraw7::EnumDisplayModes. Translates
|
||||
* the wineD3D values to ddraw values and calls the application callback
|
||||
*
|
||||
* Params:
|
||||
* device: The IDirectDraw7 interface to the current device
|
||||
* With, Height, Pixelformat, Refresh: Enumerated display mode
|
||||
* context: the context pointer passed to IWineD3DDevice::EnumDisplayModes
|
||||
*
|
||||
* Returns:
|
||||
* The return value from the application callback
|
||||
*
|
||||
*****************************************************************************/
|
||||
static HRESULT WINAPI
|
||||
IDirectDrawImpl_EnumDisplayModesCB(IUnknown *pDevice,
|
||||
UINT Width,
|
||||
UINT Height,
|
||||
WINED3DFORMAT Pixelformat,
|
||||
FLOAT Refresh,
|
||||
void *context)
|
||||
{
|
||||
DDSURFACEDESC2 callback_sd;
|
||||
EnumDisplayModesCBS *cbs = (EnumDisplayModesCBS *) context;
|
||||
|
||||
memset(&callback_sd, 0, sizeof(callback_sd));
|
||||
callback_sd.dwSize = sizeof(callback_sd);
|
||||
callback_sd.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
|
||||
|
||||
callback_sd.dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT|DDSD_PITCH;
|
||||
if(Refresh > 0.0)
|
||||
{
|
||||
callback_sd.dwFlags |= DDSD_REFRESHRATE;
|
||||
callback_sd.u2.dwRefreshRate = 60.0;
|
||||
}
|
||||
|
||||
callback_sd.dwHeight = Height;
|
||||
callback_sd.dwWidth = Width;
|
||||
|
||||
PixelFormat_WineD3DtoDD(&callback_sd.u4.ddpfPixelFormat, Pixelformat);
|
||||
return cbs->callback(&callback_sd, cbs->context);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectDraw7::EnumDisplayModes
|
||||
*
|
||||
|
@ -1204,34 +1160,59 @@ IDirectDrawImpl_EnumDisplayModes(IDirectDraw7 *iface,
|
|||
LPDDENUMMODESCALLBACK2 cb)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw7, iface);
|
||||
UINT Width = 0, Height = 0;
|
||||
unsigned int modenum = 0;
|
||||
WINED3DFORMAT pixelformat = WINED3DFMT_UNKNOWN;
|
||||
EnumDisplayModesCBS cbs;
|
||||
WINED3DDISPLAYMODE mode;
|
||||
DDSURFACEDESC2 callback_sd;
|
||||
|
||||
TRACE("(%p)->(%p,%p,%p): Relay\n", This, DDSD, Context, cb);
|
||||
|
||||
/* This looks sane */
|
||||
if(!cb) return DDERR_INVALIDPARAMS;
|
||||
|
||||
/* The private callback structure */
|
||||
cbs.callback = cb;
|
||||
cbs.context = Context;
|
||||
|
||||
if(DDSD)
|
||||
{
|
||||
if (DDSD->dwFlags & DDSD_WIDTH)
|
||||
Width = DDSD->dwWidth;
|
||||
if (DDSD->dwFlags & DDSD_HEIGHT)
|
||||
Height = DDSD->dwHeight;
|
||||
if ((DDSD->dwFlags & DDSD_PIXELFORMAT) && (DDSD->u4.ddpfPixelFormat.dwFlags & DDPF_RGB) )
|
||||
pixelformat = PixelFormat_DD2WineD3D(&DDSD->u4.ddpfPixelFormat);
|
||||
}
|
||||
|
||||
return IWineD3DDevice_EnumDisplayModes(This->wineD3DDevice,
|
||||
Flags,
|
||||
Width, Height, pixelformat,
|
||||
&cbs,
|
||||
IDirectDrawImpl_EnumDisplayModesCB);
|
||||
while(IWineD3D_EnumAdapterModes(This->wineD3D,
|
||||
WINED3DADAPTER_DEFAULT,
|
||||
pixelformat,
|
||||
modenum++,
|
||||
&mode) == WINED3D_OK) {
|
||||
if(DDSD)
|
||||
{
|
||||
if(DDSD->dwFlags & DDSD_WIDTH && mode.Width != DDSD->dwWidth) continue;
|
||||
if(DDSD->dwFlags & DDSD_HEIGHT && mode.Height != DDSD->dwHeight) continue;
|
||||
}
|
||||
|
||||
memset(&callback_sd, 0, sizeof(callback_sd));
|
||||
callback_sd.dwSize = sizeof(callback_sd);
|
||||
callback_sd.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
|
||||
|
||||
callback_sd.dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT|DDSD_PITCH;
|
||||
if(Flags & DDEDM_REFRESHRATES)
|
||||
{
|
||||
callback_sd.dwFlags |= DDSD_REFRESHRATE;
|
||||
callback_sd.u2.dwRefreshRate = mode.RefreshRate;
|
||||
}
|
||||
|
||||
callback_sd.dwWidth = mode.Width;
|
||||
callback_sd.dwHeight = mode.Height;
|
||||
|
||||
PixelFormat_WineD3DtoDD(&callback_sd.u4.ddpfPixelFormat, mode.Format);
|
||||
|
||||
TRACE("Enumerating %dx%d@%d\n", callback_sd.dwWidth, callback_sd.dwHeight, callback_sd.u4.ddpfPixelFormat.u1.dwRGBBitCount);
|
||||
|
||||
if(cb(&callback_sd, Context) == DDENUMRET_CANCEL)
|
||||
{
|
||||
TRACE("Application asked to terminate the enumeration\n");
|
||||
return DD_OK;
|
||||
}
|
||||
}
|
||||
TRACE("End of enumeration\n");
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
|
@ -1822,30 +1822,6 @@ static void WINAPI IWineD3DDeviceImpl_SetFullscreen(IWineD3DDevice *iface, BOOL
|
|||
This->ddraw_fullscreen = fullscreen;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_EnumDisplayModes(IWineD3DDevice *iface, DWORD Flags, UINT Width, UINT Height, WINED3DFORMAT pixelformat, LPVOID context, D3DCB_ENUMDISPLAYMODESCALLBACK callback) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
|
||||
DEVMODEW DevModeW;
|
||||
int i;
|
||||
const PixelFormatDesc *formatDesc = getFormatDescEntry(pixelformat);
|
||||
|
||||
TRACE("(%p)->(%x,%d,%d,%d,%p,%p)\n", This, Flags, Width, Height, pixelformat, context, callback);
|
||||
|
||||
for (i = 0; EnumDisplaySettingsExW(NULL, i, &DevModeW, 0); i++) {
|
||||
/* Ignore some modes if a description was passed */
|
||||
if ( (Width > 0) && (Width != DevModeW.dmPelsWidth)) continue;
|
||||
if ( (Height > 0) && (Height != DevModeW.dmPelsHeight)) continue;
|
||||
if ( (pixelformat != WINED3DFMT_UNKNOWN) && ( formatDesc->bpp != DevModeW.dmBitsPerPel) ) continue;
|
||||
|
||||
TRACE("Enumerating %dx%d@%s\n", DevModeW.dmPelsWidth, DevModeW.dmPelsHeight, debug_d3dformat(pixelformat_for_depth(DevModeW.dmBitsPerPel)));
|
||||
|
||||
if (callback((IUnknown *) This, (UINT) DevModeW.dmPelsWidth, (UINT) DevModeW.dmPelsHeight, pixelformat_for_depth(DevModeW.dmBitsPerPel), 60.0, context) == DDENUMRET_CANCEL)
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, UINT iSwapChain, WINED3DDISPLAYMODE* pMode) {
|
||||
DEVMODEW devmode;
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
|
@ -5713,7 +5689,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
|
|||
IWineD3DDeviceImpl_Init3D,
|
||||
IWineD3DDeviceImpl_Uninit3D,
|
||||
IWineD3DDeviceImpl_SetFullscreen,
|
||||
IWineD3DDeviceImpl_EnumDisplayModes,
|
||||
IWineD3DDeviceImpl_EvictManagedResources,
|
||||
IWineD3DDeviceImpl_GetAvailableTextureMem,
|
||||
IWineD3DDeviceImpl_GetBackBuffer,
|
||||
|
|
|
@ -233,13 +233,6 @@ typedef HRESULT WINAPI (*D3DCB_CREATEADDITIONALSWAPCHAIN) (IUnknown *pDevice,
|
|||
struct IWineD3DSwapChain **pSwapChain
|
||||
);
|
||||
|
||||
typedef HRESULT WINAPI (*D3DCB_ENUMDISPLAYMODESCALLBACK) (IUnknown *pDevice,
|
||||
UINT Width,
|
||||
UINT Height,
|
||||
WINED3DFORMAT Pixelformat,
|
||||
FLOAT Refresh,
|
||||
LPVOID context);
|
||||
|
||||
/*****************************************************************************
|
||||
* Callback functions for custom implicit object destruction.
|
||||
*/
|
||||
|
@ -363,7 +356,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
|||
STDMETHOD(Init3D)(THIS_ WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATEADDITIONALSWAPCHAIN D3DCB_CreateAdditionalSwapChain);
|
||||
STDMETHOD(Uninit3D)(THIS, D3DCB_DESTROYSURFACEFN pFn, D3DCB_DESTROYSWAPCHAINFN pFn2);
|
||||
STDMETHOD_(void, SetFullscreen)(THIS_ BOOL fullscreen);
|
||||
STDMETHOD(EnumDisplayModes)(THIS_ DWORD Flags, UINT Width, UINT Height, WINED3DFORMAT Format, void *context, D3DCB_ENUMDISPLAYMODESCALLBACK cb) PURE;
|
||||
STDMETHOD(EvictManagedResources)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE;
|
||||
STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain, UINT BackBuffer, WINED3DBACKBUFFER_TYPE, struct IWineD3DSurface** ppBackBuffer) PURE;
|
||||
|
@ -500,7 +492,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
|||
#define IWineD3DDevice_Init3D(p, a, b) (p)->lpVtbl->Init3D(p, a, b)
|
||||
#define IWineD3DDevice_Uninit3D(p, a, b) (p)->lpVtbl->Uninit3D(p, a, b)
|
||||
#define IWineD3DDevice_SetFullscreen(p, a) (p)->lpVtbl->SetFullscreen(p, a)
|
||||
#define IWineD3DDevice_EnumDisplayModes(p,a,b,c,d,e,f) (p)->lpVtbl->EnumDisplayModes(p,a,b,c,d,e,f)
|
||||
#define IWineD3DDevice_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p)
|
||||
#define IWineD3DDevice_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p)
|
||||
#define IWineD3DDevice_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d)
|
||||
|
|
Loading…
Reference in New Issue