diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 648c63d8f42..2233e2576b1 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2071,7 +2071,7 @@ static HRESULT WINAPI ddraw3_GetGDISurface(IDirectDraw3 *iface, IDirectDrawSurfa return hr; } surface_impl = impl_from_IDirectDrawSurface7(surface7); - *surface = (IDirectDrawSurface *)&surface_impl->IDirectDrawSurface3_iface; + *surface = &surface_impl->IDirectDrawSurface_iface; return hr; } @@ -2092,7 +2092,7 @@ static HRESULT WINAPI ddraw2_GetGDISurface(IDirectDraw2 *iface, IDirectDrawSurfa return hr; } surface_impl = impl_from_IDirectDrawSurface7(surface7); - *surface = (IDirectDrawSurface *)&surface_impl->IDirectDrawSurface3_iface; + *surface = &surface_impl->IDirectDrawSurface_iface; return hr; } @@ -2113,7 +2113,7 @@ static HRESULT WINAPI ddraw1_GetGDISurface(IDirectDraw *iface, IDirectDrawSurfac return hr; } surface_impl = impl_from_IDirectDrawSurface7(surface7); - *surface = (IDirectDrawSurface *)&surface_impl->IDirectDrawSurface3_iface; + *surface = &surface_impl->IDirectDrawSurface_iface; return hr; } @@ -2486,7 +2486,7 @@ static HRESULT WINAPI ddraw4_GetSurfaceFromDC(IDirectDraw4 *iface, HDC dc, } surface_impl = impl_from_IDirectDrawSurface7(surface7); /* Tests say this is true */ - *surface = (IDirectDrawSurface4 *)&surface_impl->IDirectDrawSurface3_iface; + *surface = (IDirectDrawSurface4 *)&surface_impl->IDirectDrawSurface_iface; return hr; } @@ -2511,7 +2511,7 @@ static HRESULT WINAPI ddraw3_GetSurfaceFromDC(IDirectDraw3 *iface, HDC dc, } surface_impl = impl_from_IDirectDrawSurface7(surface7); - *surface = (IDirectDrawSurface *)&surface_impl->IDirectDrawSurface3_iface; + *surface = &surface_impl->IDirectDrawSurface_iface; return hr; } @@ -3605,7 +3605,7 @@ static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, DDSURFACEDESC *s return hr; } - *surface = (IDirectDrawSurface *)&impl->IDirectDrawSurface3_iface; + *surface = &impl->IDirectDrawSurface_iface; ddraw_set_surface_version(impl, 3); IDirectDraw7_Release(&This->IDirectDraw7_iface); IDirectDraw3_AddRef(iface); @@ -3649,7 +3649,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface, return hr; } - *surface = (IDirectDrawSurface *)&impl->IDirectDrawSurface3_iface; + *surface = &impl->IDirectDrawSurface_iface; ddraw_set_surface_version(impl, 2); IDirectDraw7_Release(&This->IDirectDraw7_iface); impl->ifaceToRelease = NULL; @@ -3683,7 +3683,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface, return hr; } - *surface = (IDirectDrawSurface *)&impl->IDirectDrawSurface3_iface; + *surface = &impl->IDirectDrawSurface_iface; ddraw_set_surface_version(impl, 1); IDirectDraw7_Release(&This->IDirectDraw7_iface); impl->ifaceToRelease = NULL; @@ -3815,7 +3815,7 @@ static HRESULT CALLBACK EnumSurfacesCallbackThunk(IDirectDrawSurface7 *surface, IDirectDrawSurfaceImpl *surface_impl = impl_from_IDirectDrawSurface7(surface); struct surfacescallback_context *cbcontext = context; - return cbcontext->func((IDirectDrawSurface *)&surface_impl->IDirectDrawSurface3_iface, + return cbcontext->func(&surface_impl->IDirectDrawSurface_iface, (DDSURFACEDESC *)surface_desc, cbcontext->context); } @@ -4277,7 +4277,7 @@ static HRESULT WINAPI ddraw3_DuplicateSurface(IDirectDraw3 *iface, IDirectDrawSu if (FAILED(hr)) return hr; dst_impl = impl_from_IDirectDrawSurface7(dst7); - *dst = (IDirectDrawSurface *)&dst_impl->IDirectDrawSurface3_iface; + *dst = &dst_impl->IDirectDrawSurface_iface; return hr; } @@ -4297,7 +4297,7 @@ static HRESULT WINAPI ddraw2_DuplicateSurface(IDirectDraw2 *iface, if (FAILED(hr)) return hr; dst_impl = impl_from_IDirectDrawSurface7(dst7); - *dst = (IDirectDrawSurface *)&dst_impl->IDirectDrawSurface3_iface; + *dst = &dst_impl->IDirectDrawSurface_iface; return hr; } @@ -4317,7 +4317,7 @@ static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSur if (FAILED(hr)) return hr; dst_impl = impl_from_IDirectDrawSurface7(dst7); - *dst = (IDirectDrawSurface *)&dst_impl->IDirectDrawSurface3_iface; + *dst = &dst_impl->IDirectDrawSurface_iface; return hr; } diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 160ae44bb4a..cfea63e929d 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -156,6 +156,7 @@ struct IDirectDrawSurfaceImpl IDirectDrawSurface4 IDirectDrawSurface4_iface; IDirectDrawSurface3 IDirectDrawSurface3_iface; IDirectDrawSurface2 IDirectDrawSurface2_iface; + IDirectDrawSurface IDirectDrawSurface_iface; IDirectDrawGammaControl IDirectDrawGammaControl_iface; const IDirect3DTexture2Vtbl *IDirect3DTexture2_vtbl; const IDirect3DTextureVtbl *IDirect3DTexture_vtbl; @@ -222,6 +223,11 @@ static inline IDirectDrawSurfaceImpl *surface_from_texture2(IDirect3DTexture2 *i return (IDirectDrawSurfaceImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawSurfaceImpl, IDirect3DTexture2_vtbl)); } +static inline IDirectDrawSurfaceImpl *impl_from_IDirectDrawSurface(IDirectDrawSurface *iface) +{ + return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface_iface); +} + static inline IDirectDrawSurfaceImpl *impl_from_IDirectDrawSurface2(IDirectDrawSurface2 *iface) { return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface2_iface); diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index c4ad855fe31..9fb5b69fecd 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -1981,7 +1981,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_GetRenderTarget(IDirect3DDevice2 *if hr = IDirect3DDevice7_GetRenderTarget((IDirect3DDevice7 *)This, &RenderTarget7); if(hr != D3D_OK) return hr; RenderTargetImpl = impl_from_IDirectDrawSurface7(RenderTarget7); - *RenderTarget = (IDirectDrawSurface *)&RenderTargetImpl->IDirectDrawSurface3_iface; + *RenderTarget = &RenderTargetImpl->IDirectDrawSurface_iface; return D3D_OK; } diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index eb9dd29cbfa..0d0220f75d4 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -85,8 +85,7 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface, TRACE("(%p) returning IDirectDrawSurface4 interface at %p\n", This, *obj); return S_OK; } - else if( IsEqualGUID(riid, &IID_IDirectDrawSurface3) - || IsEqualGUID(riid, &IID_IDirectDrawSurface) ) + else if (IsEqualGUID(riid, &IID_IDirectDrawSurface3)) { IUnknown_AddRef(iface); *obj = &This->IDirectDrawSurface3_iface; @@ -100,6 +99,13 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface, TRACE("(%p) returning IDirectDrawSurface2 interface at %p\n", This, *obj); return S_OK; } + else if (IsEqualGUID(riid, &IID_IDirectDrawSurface)) + { + IUnknown_AddRef(iface); + *obj = &This->IDirectDrawSurface_iface; + TRACE("(%p) returning IDirectDrawSurface interface at %p\n", This, *obj); + return S_OK; + } else if( IsEqualGUID(riid, &IID_IDirectDrawGammaControl) ) { IUnknown_AddRef(iface); @@ -172,6 +178,14 @@ static HRESULT WINAPI ddraw_surface2_QueryInterface(IDirectDrawSurface2 *iface, return ddraw_surface7_QueryInterface(&This->IDirectDrawSurface7_iface, riid, object); } +static HRESULT WINAPI ddraw_surface1_QueryInterface(IDirectDrawSurface *iface, REFIID riid, void **object) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + + return ddraw_surface7_QueryInterface(&This->IDirectDrawSurface7_iface, riid, object); +} + static HRESULT WINAPI ddraw_gamma_control_QueryInterface(IDirectDrawGammaControl *iface, REFIID riid, void **object) { @@ -251,6 +265,14 @@ static ULONG WINAPI ddraw_surface2_AddRef(IDirectDrawSurface2 *iface) return ddraw_surface7_AddRef(&This->IDirectDrawSurface7_iface); } +static ULONG WINAPI ddraw_surface1_AddRef(IDirectDrawSurface *iface) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p.\n", iface); + + return ddraw_surface7_AddRef(&This->IDirectDrawSurface7_iface); +} + static ULONG WINAPI ddraw_gamma_control_AddRef(IDirectDrawGammaControl *iface) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawGammaControl(iface); @@ -478,6 +500,14 @@ static ULONG WINAPI ddraw_surface2_Release(IDirectDrawSurface2 *iface) return ddraw_surface7_Release(&This->IDirectDrawSurface7_iface); } +static ULONG WINAPI ddraw_surface1_Release(IDirectDrawSurface *iface) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p.\n", iface); + + return ddraw_surface7_Release(&This->IDirectDrawSurface7_iface); +} + static ULONG WINAPI ddraw_gamma_control_Release(IDirectDrawGammaControl *iface) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawGammaControl(iface); @@ -702,6 +732,35 @@ static HRESULT WINAPI ddraw_surface2_GetAttachedSurface(IDirectDrawSurface2 *ifa return hr; } +static HRESULT WINAPI ddraw_surface1_GetAttachedSurface(IDirectDrawSurface *iface, + DDSCAPS *caps, IDirectDrawSurface **attachment) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + IDirectDrawSurface7 *attachment7; + IDirectDrawSurfaceImpl *attachment_impl; + DDSCAPS2 caps2; + HRESULT hr; + + TRACE("iface %p, caps %p, attachment %p.\n", iface, caps, attachment); + + caps2.dwCaps = caps->dwCaps; + caps2.dwCaps2 = 0; + caps2.dwCaps3 = 0; + caps2.dwCaps4 = 0; + + hr = ddraw_surface7_GetAttachedSurface(&This->IDirectDrawSurface7_iface, + &caps2, &attachment7); + if (FAILED(hr)) + { + *attachment = NULL; + return hr; + } + attachment_impl = impl_from_IDirectDrawSurface7(attachment7); + *attachment = &attachment_impl->IDirectDrawSurface_iface; + + return hr; +} + /***************************************************************************** * IDirectDrawSurface7::Lock * @@ -831,6 +890,17 @@ static HRESULT WINAPI ddraw_surface2_Lock(IDirectDrawSurface2 *iface, RECT *rect rect, (DDSURFACEDESC2 *)surface_desc, flags, h); } +static HRESULT WINAPI ddraw_surface1_Lock(IDirectDrawSurface *iface, RECT *rect, + DDSURFACEDESC *surface_desc, DWORD flags, HANDLE h) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, rect %s, surface_desc %p, flags %#x, h %p.\n", + iface, wine_dbgstr_rect(rect), surface_desc, flags, h); + + return ddraw_surface7_Lock(&This->IDirectDrawSurface7_iface, + rect, (DDSURFACEDESC2 *)surface_desc, flags, h); +} + /***************************************************************************** * IDirectDrawSurface7::Unlock * @@ -887,6 +957,15 @@ static HRESULT WINAPI ddraw_surface2_Unlock(IDirectDrawSurface2 *iface, void *da return ddraw_surface7_Unlock(&This->IDirectDrawSurface7_iface, NULL); } +static HRESULT WINAPI ddraw_surface1_Unlock(IDirectDrawSurface *iface, void *data) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, data %p.\n", iface, data); + + /* data might not be the LPRECT of later versions, so drop it. */ + return ddraw_surface7_Unlock(&This->IDirectDrawSurface7_iface, NULL); +} + /***************************************************************************** * IDirectDrawSurface7::Flip * @@ -978,6 +1057,16 @@ static HRESULT WINAPI ddraw_surface2_Flip(IDirectDrawSurface2 *iface, IDirectDra dst_impl ? &dst_impl->IDirectDrawSurface7_iface : NULL, flags); } +static HRESULT WINAPI ddraw_surface1_Flip(IDirectDrawSurface *iface, IDirectDrawSurface *dst, DWORD flags) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + IDirectDrawSurfaceImpl *dst_impl = unsafe_impl_from_IDirectDrawSurface(dst); + TRACE("iface %p, dst %p, flags %#x.\n", iface, dst, flags); + + return ddraw_surface7_Flip(&This->IDirectDrawSurface7_iface, + dst_impl ? &dst_impl->IDirectDrawSurface7_iface : NULL, flags); +} + /***************************************************************************** * IDirectDrawSurface7::Blt * @@ -1101,6 +1190,18 @@ static HRESULT WINAPI ddraw_surface2_Blt(IDirectDrawSurface2 *iface, RECT *dst_r src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags, fx); } +static HRESULT WINAPI ddraw_surface1_Blt(IDirectDrawSurface *iface, RECT *dst_rect, + IDirectDrawSurface *src_surface, RECT *src_rect, DWORD flags, DDBLTFX *fx) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface(src_surface); + TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n", + iface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx); + + return ddraw_surface7_Blt(&This->IDirectDrawSurface7_iface, dst_rect, + src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags, fx); +} + /***************************************************************************** * IDirectDrawSurface7::AddAttachedSurface * @@ -1261,6 +1362,17 @@ static HRESULT WINAPI ddraw_surface2_AddAttachedSurface(IDirectDrawSurface2 *ifa attachment_impl ? &attachment_impl->IDirectDrawSurface3_iface : NULL); } +static HRESULT WINAPI ddraw_surface1_AddAttachedSurface(IDirectDrawSurface *iface, IDirectDrawSurface *attachment) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface(attachment); + + TRACE("iface %p, attachment %p.\n", iface, attachment); + + return ddraw_surface3_AddAttachedSurface(&This->IDirectDrawSurface3_iface, + attachment_impl ? &attachment_impl->IDirectDrawSurface3_iface : NULL); +} + /***************************************************************************** * IDirectDrawSurface7::DeleteAttachedSurface * @@ -1360,6 +1472,17 @@ static HRESULT WINAPI ddraw_surface2_DeleteAttachedSurface(IDirectDrawSurface2 * attachment_impl ? &attachment_impl->IDirectDrawSurface7_iface : NULL); } +static HRESULT WINAPI ddraw_surface1_DeleteAttachedSurface(IDirectDrawSurface *iface, + DWORD flags, IDirectDrawSurface *attachment) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface(attachment); + TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment); + + return ddraw_surface7_DeleteAttachedSurface(&This->IDirectDrawSurface7_iface, flags, + attachment_impl ? &attachment_impl->IDirectDrawSurface7_iface : NULL); +} + /***************************************************************************** * IDirectDrawSurface7::AddOverlayDirtyRect * @@ -1403,6 +1526,14 @@ static HRESULT WINAPI ddraw_surface2_AddOverlayDirtyRect(IDirectDrawSurface2 *if return ddraw_surface7_AddOverlayDirtyRect(&This->IDirectDrawSurface7_iface, rect); } +static HRESULT WINAPI ddraw_surface1_AddOverlayDirtyRect(IDirectDrawSurface *iface, RECT *rect) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(rect)); + + return ddraw_surface7_AddOverlayDirtyRect(&This->IDirectDrawSurface7_iface, rect); +} + /***************************************************************************** * IDirectDrawSurface7::GetDC * @@ -1467,6 +1598,14 @@ static HRESULT WINAPI ddraw_surface2_GetDC(IDirectDrawSurface2 *iface, HDC *dc) return ddraw_surface7_GetDC(&This->IDirectDrawSurface7_iface, dc); } +static HRESULT WINAPI ddraw_surface1_GetDC(IDirectDrawSurface *iface, HDC *dc) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, dc %p.\n", iface, dc); + + return ddraw_surface7_GetDC(&This->IDirectDrawSurface7_iface, dc); +} + /***************************************************************************** * IDirectDrawSurface7::ReleaseDC * @@ -1517,6 +1656,14 @@ static HRESULT WINAPI ddraw_surface2_ReleaseDC(IDirectDrawSurface2 *iface, HDC d return ddraw_surface7_ReleaseDC(&This->IDirectDrawSurface7_iface, dc); } +static HRESULT WINAPI ddraw_surface1_ReleaseDC(IDirectDrawSurface *iface, HDC dc) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, dc %p.\n", iface, dc); + + return ddraw_surface7_ReleaseDC(&This->IDirectDrawSurface7_iface, dc); +} + /***************************************************************************** * IDirectDrawSurface7::GetCaps * @@ -1581,6 +1728,21 @@ static HRESULT WINAPI ddraw_surface2_GetCaps(IDirectDrawSurface2 *iface, DDSCAPS return hr; } +static HRESULT WINAPI ddraw_surface1_GetCaps(IDirectDrawSurface *iface, DDSCAPS *caps) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + DDSCAPS2 caps2; + HRESULT hr; + + TRACE("iface %p, caps %p.\n", iface, caps); + + hr = ddraw_surface7_GetCaps(&This->IDirectDrawSurface7_iface, &caps2); + if (FAILED(hr)) return hr; + + caps->dwCaps = caps2.dwCaps; + return hr; +} + /***************************************************************************** * IDirectDrawSurface7::SetPriority * @@ -1804,7 +1966,6 @@ static HRESULT WINAPI ddraw_surface2_PageLock(IDirectDrawSurface2 *iface, DWORD return ddraw_surface7_PageLock(&This->IDirectDrawSurface7_iface, flags); } - /***************************************************************************** * IDirectDrawSurface7::PageUnlock * @@ -1892,6 +2053,14 @@ static HRESULT WINAPI ddraw_surface2_BltBatch(IDirectDrawSurface2 *iface, DDBLTB return ddraw_surface7_BltBatch(&This->IDirectDrawSurface7_iface, batch, count, flags); } +static HRESULT WINAPI ddraw_surface1_BltBatch(IDirectDrawSurface *iface, DDBLTBATCH *batch, DWORD count, DWORD flags) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, batch %p, count %u, flags %#x.\n", iface, batch, count, flags); + + return ddraw_surface7_BltBatch(&This->IDirectDrawSurface7_iface, batch, count, flags); +} + /***************************************************************************** * IDirectDrawSurface7::EnumAttachedSurfaces * @@ -1979,7 +2148,7 @@ static HRESULT CALLBACK EnumCallback(IDirectDrawSurface7 *surface, DDSURFACEDESC IDirectDrawSurfaceImpl *surface_impl = impl_from_IDirectDrawSurface7(surface); const struct callback_info *info = context; - return info->callback((IDirectDrawSurface *)&surface_impl->IDirectDrawSurface3_iface, + return info->callback(&surface_impl->IDirectDrawSurface_iface, (DDSURFACEDESC *)surface_desc, info->context); } @@ -2028,6 +2197,21 @@ static HRESULT WINAPI ddraw_surface2_EnumAttachedSurfaces(IDirectDrawSurface2 *i &info, EnumCallback); } +static HRESULT WINAPI ddraw_surface1_EnumAttachedSurfaces(IDirectDrawSurface *iface, + void *context, LPDDENUMSURFACESCALLBACK callback) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + struct callback_info info; + + TRACE("iface %p, context %p, callback %p.\n", iface, context, callback); + + info.callback = callback; + info.context = context; + + return ddraw_surface7_EnumAttachedSurfaces(&This->IDirectDrawSurface7_iface, + &info, EnumCallback); +} + /***************************************************************************** * IDirectDrawSurface7::EnumOverlayZOrders * @@ -2095,6 +2279,21 @@ static HRESULT WINAPI ddraw_surface2_EnumOverlayZOrders(IDirectDrawSurface2 *ifa flags, &info, EnumCallback); } +static HRESULT WINAPI ddraw_surface1_EnumOverlayZOrders(IDirectDrawSurface *iface, + DWORD flags, void *context, LPDDENUMSURFACESCALLBACK callback) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + struct callback_info info; + + TRACE("iface %p, flags %#x, context %p, callback %p.\n", iface, flags, context, callback); + + info.callback = callback; + info.context = context; + + return ddraw_surface7_EnumOverlayZOrders(&This->IDirectDrawSurface7_iface, + flags, &info, EnumCallback); +} + /***************************************************************************** * IDirectDrawSurface7::GetBltStatus * @@ -2148,6 +2347,14 @@ static HRESULT WINAPI ddraw_surface2_GetBltStatus(IDirectDrawSurface2 *iface, DW return ddraw_surface7_GetBltStatus(&This->IDirectDrawSurface7_iface, flags); } +static HRESULT WINAPI ddraw_surface1_GetBltStatus(IDirectDrawSurface *iface, DWORD flags) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, flags %#x.\n", iface, flags); + + return ddraw_surface7_GetBltStatus(&This->IDirectDrawSurface7_iface, flags); +} + /***************************************************************************** * IDirectDrawSurface7::GetColorKey * @@ -2244,6 +2451,14 @@ static HRESULT WINAPI ddraw_surface2_GetColorKey(IDirectDrawSurface2 *iface, DWO return ddraw_surface7_GetColorKey(&This->IDirectDrawSurface7_iface, flags, color_key); } +static HRESULT WINAPI ddraw_surface1_GetColorKey(IDirectDrawSurface *iface, DWORD flags, DDCOLORKEY *color_key) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key); + + return ddraw_surface7_GetColorKey(&This->IDirectDrawSurface7_iface, flags, color_key); +} + /***************************************************************************** * IDirectDrawSurface7::GetFlipStatus * @@ -2297,6 +2512,14 @@ static HRESULT WINAPI ddraw_surface2_GetFlipStatus(IDirectDrawSurface2 *iface, D return ddraw_surface7_GetFlipStatus(&This->IDirectDrawSurface7_iface, flags); } +static HRESULT WINAPI ddraw_surface1_GetFlipStatus(IDirectDrawSurface *iface, DWORD flags) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, flags %#x.\n", iface, flags); + + return ddraw_surface7_GetFlipStatus(&This->IDirectDrawSurface7_iface, flags); +} + /***************************************************************************** * IDirectDrawSurface7::GetOverlayPosition * @@ -2346,6 +2569,14 @@ static HRESULT WINAPI ddraw_surface2_GetOverlayPosition(IDirectDrawSurface2 *ifa return ddraw_surface7_GetOverlayPosition(&This->IDirectDrawSurface7_iface, x, y); } +static HRESULT WINAPI ddraw_surface1_GetOverlayPosition(IDirectDrawSurface *iface, LONG *x, LONG *y) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, x %p, y %p.\n", iface, x, y); + + return ddraw_surface7_GetOverlayPosition(&This->IDirectDrawSurface7_iface, x, y); +} + /***************************************************************************** * IDirectDrawSurface7::GetPixelFormat * @@ -2401,6 +2632,14 @@ static HRESULT WINAPI ddraw_surface2_GetPixelFormat(IDirectDrawSurface2 *iface, return ddraw_surface7_GetPixelFormat(&This->IDirectDrawSurface7_iface, pixel_format); } +static HRESULT WINAPI ddraw_surface1_GetPixelFormat(IDirectDrawSurface *iface, DDPIXELFORMAT *pixel_format) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, pixel_format %p.\n", iface, pixel_format); + + return ddraw_surface7_GetPixelFormat(&This->IDirectDrawSurface7_iface, pixel_format); +} + /***************************************************************************** * IDirectDrawSurface7::GetSurfaceDesc * @@ -2482,6 +2721,14 @@ static HRESULT WINAPI ddraw_surface2_GetSurfaceDesc(IDirectDrawSurface2 *iface, return ddraw_surface3_GetSurfaceDesc(&This->IDirectDrawSurface3_iface, DDSD); } +static HRESULT WINAPI ddraw_surface1_GetSurfaceDesc(IDirectDrawSurface *iface, DDSURFACEDESC *DDSD) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, surface_desc %p.\n", iface, DDSD); + + return ddraw_surface3_GetSurfaceDesc(&This->IDirectDrawSurface3_iface, DDSD); +} + /***************************************************************************** * IDirectDrawSurface7::Initialize * @@ -2533,6 +2780,16 @@ static HRESULT WINAPI ddraw_surface2_Initialize(IDirectDrawSurface2 *iface, ddraw, (DDSURFACEDESC2 *)surface_desc); } +static HRESULT WINAPI ddraw_surface1_Initialize(IDirectDrawSurface *iface, + IDirectDraw *ddraw, DDSURFACEDESC *surface_desc) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, ddraw %p, surface_desc %p.\n", iface, ddraw, surface_desc); + + return ddraw_surface7_Initialize(&This->IDirectDrawSurface7_iface, + ddraw, (DDSURFACEDESC2 *)surface_desc); +} + /***************************************************************************** * IDirect3DTexture1::Initialize * @@ -2620,6 +2877,14 @@ static HRESULT WINAPI ddraw_surface2_IsLost(IDirectDrawSurface2 *iface) return ddraw_surface7_IsLost(&This->IDirectDrawSurface7_iface); } +static HRESULT WINAPI ddraw_surface1_IsLost(IDirectDrawSurface *iface) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p.\n", iface); + + return ddraw_surface7_IsLost(&This->IDirectDrawSurface7_iface); +} + /***************************************************************************** * IDirectDrawSurface7::Restore * @@ -2674,6 +2939,14 @@ static HRESULT WINAPI ddraw_surface2_Restore(IDirectDrawSurface2 *iface) return ddraw_surface7_Restore(&This->IDirectDrawSurface7_iface); } +static HRESULT WINAPI ddraw_surface1_Restore(IDirectDrawSurface *iface) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p.\n", iface); + + return ddraw_surface7_Restore(&This->IDirectDrawSurface7_iface); +} + /***************************************************************************** * IDirectDrawSurface7::SetOverlayPosition * @@ -2723,6 +2996,14 @@ static HRESULT WINAPI ddraw_surface2_SetOverlayPosition(IDirectDrawSurface2 *ifa return ddraw_surface7_SetOverlayPosition(&This->IDirectDrawSurface7_iface, x, y); } +static HRESULT WINAPI ddraw_surface1_SetOverlayPosition(IDirectDrawSurface *iface, LONG x, LONG y) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, x %d, y %d.\n", iface, x, y); + + return ddraw_surface7_SetOverlayPosition(&This->IDirectDrawSurface7_iface, x, y); +} + /***************************************************************************** * IDirectDrawSurface7::UpdateOverlay * @@ -2797,6 +3078,18 @@ static HRESULT WINAPI ddraw_surface2_UpdateOverlay(IDirectDrawSurface2 *iface, R dst_impl ? &dst_impl->IDirectDrawSurface7_iface : NULL, dst_rect, flags, fx); } +static HRESULT WINAPI ddraw_surface1_UpdateOverlay(IDirectDrawSurface *iface, RECT *src_rect, + IDirectDrawSurface *dst_surface, RECT *dst_rect, DWORD flags, DDOVERLAYFX *fx) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + IDirectDrawSurfaceImpl *dst_impl = unsafe_impl_from_IDirectDrawSurface(dst_surface); + TRACE("iface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n", + iface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx); + + return ddraw_surface7_UpdateOverlay(&This->IDirectDrawSurface7_iface, src_rect, + dst_impl ? &dst_impl->IDirectDrawSurface7_iface : NULL, dst_rect, flags, fx); +} + /***************************************************************************** * IDirectDrawSurface7::UpdateOverlayDisplay * @@ -2839,6 +3132,14 @@ static HRESULT WINAPI ddraw_surface2_UpdateOverlayDisplay(IDirectDrawSurface2 *i return ddraw_surface7_UpdateOverlayDisplay(&This->IDirectDrawSurface7_iface, flags); } +static HRESULT WINAPI ddraw_surface1_UpdateOverlayDisplay(IDirectDrawSurface *iface, DWORD flags) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, flags %#x.\n", iface, flags); + + return ddraw_surface7_UpdateOverlayDisplay(&This->IDirectDrawSurface7_iface, flags); +} + /***************************************************************************** * IDirectDrawSurface7::UpdateOverlayZOrder * @@ -2901,6 +3202,17 @@ static HRESULT WINAPI ddraw_surface2_UpdateOverlayZOrder(IDirectDrawSurface2 *if reference_impl ? &reference_impl->IDirectDrawSurface7_iface : NULL); } +static HRESULT WINAPI ddraw_surface1_UpdateOverlayZOrder(IDirectDrawSurface *iface, + DWORD flags, IDirectDrawSurface *reference) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + IDirectDrawSurfaceImpl *reference_impl = unsafe_impl_from_IDirectDrawSurface(reference); + TRACE("iface %p, flags %#x, reference %p.\n", iface, flags, reference); + + return ddraw_surface7_UpdateOverlayZOrder(&This->IDirectDrawSurface7_iface, flags, + reference_impl ? &reference_impl->IDirectDrawSurface7_iface : NULL); +} + /***************************************************************************** * IDirectDrawSurface7::GetDDInterface * @@ -3213,6 +3525,18 @@ static HRESULT WINAPI ddraw_surface2_BltFast(IDirectDrawSurface2 *iface, DWORD d src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags); } +static HRESULT WINAPI ddraw_surface1_BltFast(IDirectDrawSurface *iface, DWORD dst_x, DWORD dst_y, + IDirectDrawSurface *src_surface, RECT *src_rect, DWORD flags) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface(src_surface); + TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n", + iface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), flags); + + return ddraw_surface7_BltFast(&This->IDirectDrawSurface7_iface, dst_x, dst_y, + src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags); +} + /***************************************************************************** * IDirectDrawSurface7::GetClipper * @@ -3277,6 +3601,14 @@ static HRESULT WINAPI ddraw_surface2_GetClipper(IDirectDrawSurface2 *iface, IDir return ddraw_surface7_GetClipper(&This->IDirectDrawSurface7_iface, clipper); } +static HRESULT WINAPI ddraw_surface1_GetClipper(IDirectDrawSurface *iface, IDirectDrawClipper **clipper) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, clipper %p.\n", iface, clipper); + + return ddraw_surface7_GetClipper(&This->IDirectDrawSurface7_iface, clipper); +} + /***************************************************************************** * IDirectDrawSurface7::SetClipper * @@ -3356,6 +3688,14 @@ static HRESULT WINAPI ddraw_surface2_SetClipper(IDirectDrawSurface2 *iface, IDir return ddraw_surface7_SetClipper(&This->IDirectDrawSurface7_iface, clipper); } +static HRESULT WINAPI ddraw_surface1_SetClipper(IDirectDrawSurface *iface, IDirectDrawClipper *clipper) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, clipper %p.\n", iface, clipper); + + return ddraw_surface7_SetClipper(&This->IDirectDrawSurface7_iface, clipper); +} + /***************************************************************************** * IDirectDrawSurface7::SetSurfaceDesc * @@ -3533,6 +3873,14 @@ static HRESULT WINAPI ddraw_surface2_GetPalette(IDirectDrawSurface2 *iface, IDir return ddraw_surface7_GetPalette(&This->IDirectDrawSurface7_iface, palette); } +static HRESULT WINAPI ddraw_surface1_GetPalette(IDirectDrawSurface *iface, IDirectDrawPalette **palette) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, palette %p.\n", iface, palette); + + return ddraw_surface7_GetPalette(&This->IDirectDrawSurface7_iface, palette); +} + /***************************************************************************** * SetColorKeyEnum * @@ -3687,6 +4035,14 @@ static HRESULT WINAPI ddraw_surface2_SetColorKey(IDirectDrawSurface2 *iface, DWO return ddraw_surface7_SetColorKey(&This->IDirectDrawSurface7_iface, flags, color_key); } +static HRESULT WINAPI ddraw_surface1_SetColorKey(IDirectDrawSurface *iface, DWORD flags, DDCOLORKEY *color_key) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key); + + return ddraw_surface7_SetColorKey(&This->IDirectDrawSurface7_iface, flags, color_key); +} + /***************************************************************************** * IDirectDrawSurface7::SetPalette * @@ -3786,6 +4142,14 @@ static HRESULT WINAPI ddraw_surface2_SetPalette(IDirectDrawSurface2 *iface, IDir return ddraw_surface7_SetPalette(&This->IDirectDrawSurface7_iface, palette); } +static HRESULT WINAPI ddraw_surface1_SetPalette(IDirectDrawSurface *iface, IDirectDrawPalette *palette) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); + TRACE("iface %p, palette %p.\n", iface, palette); + + return ddraw_surface7_SetPalette(&This->IDirectDrawSurface7_iface, palette); +} + /********************************************************** * IDirectDrawGammaControl::GetGammaRamp * @@ -4362,6 +4726,48 @@ static const struct IDirectDrawSurface2Vtbl ddraw_surface2_vtbl = ddraw_surface2_PageUnlock, }; +static const struct IDirectDrawSurfaceVtbl ddraw_surface1_vtbl = +{ + /* IUnknown */ + ddraw_surface1_QueryInterface, + ddraw_surface1_AddRef, + ddraw_surface1_Release, + /* IDirectDrawSurface */ + ddraw_surface1_AddAttachedSurface, + ddraw_surface1_AddOverlayDirtyRect, + ddraw_surface1_Blt, + ddraw_surface1_BltBatch, + ddraw_surface1_BltFast, + ddraw_surface1_DeleteAttachedSurface, + ddraw_surface1_EnumAttachedSurfaces, + ddraw_surface1_EnumOverlayZOrders, + ddraw_surface1_Flip, + ddraw_surface1_GetAttachedSurface, + ddraw_surface1_GetBltStatus, + ddraw_surface1_GetCaps, + ddraw_surface1_GetClipper, + ddraw_surface1_GetColorKey, + ddraw_surface1_GetDC, + ddraw_surface1_GetFlipStatus, + ddraw_surface1_GetOverlayPosition, + ddraw_surface1_GetPalette, + ddraw_surface1_GetPixelFormat, + ddraw_surface1_GetSurfaceDesc, + ddraw_surface1_Initialize, + ddraw_surface1_IsLost, + ddraw_surface1_Lock, + ddraw_surface1_ReleaseDC, + ddraw_surface1_Restore, + ddraw_surface1_SetClipper, + ddraw_surface1_SetColorKey, + ddraw_surface1_SetOverlayPosition, + ddraw_surface1_SetPalette, + ddraw_surface1_Unlock, + ddraw_surface1_UpdateOverlay, + ddraw_surface1_UpdateOverlayDisplay, + ddraw_surface1_UpdateOverlayZOrder, +}; + static const struct IDirectDrawGammaControlVtbl ddraw_gamma_control_vtbl = { ddraw_gamma_control_QueryInterface, @@ -4424,8 +4830,8 @@ IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface2(IDirectDrawSurface2 IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *iface) { if (!iface) return NULL; - assert(iface->lpVtbl == (struct IDirectDrawSurfaceVtbl *)&ddraw_surface3_vtbl); - return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface3_iface); + assert(iface->lpVtbl == &ddraw_surface1_vtbl); + return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface_iface); } static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *parent) @@ -4589,6 +4995,7 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr surface->IDirectDrawSurface4_iface.lpVtbl = &ddraw_surface4_vtbl; surface->IDirectDrawSurface3_iface.lpVtbl = &ddraw_surface3_vtbl; surface->IDirectDrawSurface2_iface.lpVtbl = &ddraw_surface2_vtbl; + surface->IDirectDrawSurface_iface.lpVtbl = &ddraw_surface1_vtbl; surface->IDirectDrawGammaControl_iface.lpVtbl = &ddraw_gamma_control_vtbl; surface->IDirect3DTexture2_vtbl = &d3d_texture2_vtbl; surface->IDirect3DTexture_vtbl = &d3d_texture1_vtbl;