ReactOS 0.4.16-dev-297-gc569aee
surface.c File Reference
#include "config.h"
#include "wine/port.h"
#include "ddraw_private.h"
Include dependency graph for surface.c:

Go to the source code of this file.

Classes

struct  callback_info2
 
struct  callback_info
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ddraw)
 
static struct ddraw_surfaceunsafe_impl_from_IDirectDrawSurface2 (IDirectDrawSurface2 *iface)
 
static struct ddraw_surfaceunsafe_impl_from_IDirectDrawSurface3 (IDirectDrawSurface3 *iface)
 
static struct ddraw_surfaceimpl_from_IDirectDrawGammaControl (IDirectDrawGammaControl *iface)
 
HRESULT ddraw_surface_update_frontbuffer (struct ddraw_surface *surface, const RECT *rect, BOOL read)
 
static HRESULT WINAPI ddraw_surface7_QueryInterface (IDirectDrawSurface7 *iface, REFIID riid, void **obj)
 
static HRESULT WINAPI ddraw_surface4_QueryInterface (IDirectDrawSurface4 *iface, REFIID riid, void **object)
 
static HRESULT WINAPI ddraw_surface3_QueryInterface (IDirectDrawSurface3 *iface, REFIID riid, void **object)
 
static HRESULT WINAPI ddraw_surface2_QueryInterface (IDirectDrawSurface2 *iface, REFIID riid, void **object)
 
static HRESULT WINAPI ddraw_surface1_QueryInterface (IDirectDrawSurface *iface, REFIID riid, void **object)
 
static HRESULT WINAPI ddraw_gamma_control_QueryInterface (IDirectDrawGammaControl *iface, REFIID riid, void **object)
 
static HRESULT WINAPI d3d_texture2_QueryInterface (IDirect3DTexture2 *iface, REFIID riid, void **object)
 
static HRESULT WINAPI d3d_texture1_QueryInterface (IDirect3DTexture *iface, REFIID riid, void **object)
 
static void ddraw_surface_add_iface (struct ddraw_surface *surface)
 
static ULONG WINAPI ddraw_surface7_AddRef (IDirectDrawSurface7 *iface)
 
static ULONG WINAPI ddraw_surface4_AddRef (IDirectDrawSurface4 *iface)
 
static ULONG WINAPI ddraw_surface3_AddRef (IDirectDrawSurface3 *iface)
 
static ULONG WINAPI ddraw_surface2_AddRef (IDirectDrawSurface2 *iface)
 
static ULONG WINAPI ddraw_surface1_AddRef (IDirectDrawSurface *iface)
 
static ULONG WINAPI ddraw_gamma_control_AddRef (IDirectDrawGammaControl *iface)
 
static ULONG WINAPI d3d_texture2_AddRef (IDirect3DTexture2 *iface)
 
static ULONG WINAPI d3d_texture1_AddRef (IDirect3DTexture *iface)
 
static HRESULT ddraw_surface_set_palette (struct ddraw_surface *surface, IDirectDrawPalette *palette)
 
static void ddraw_surface_cleanup (struct ddraw_surface *surface)
 
static ULONG ddraw_surface_release_iface (struct ddraw_surface *This)
 
static ULONG WINAPI ddraw_surface7_Release (IDirectDrawSurface7 *iface)
 
static ULONG WINAPI ddraw_surface4_Release (IDirectDrawSurface4 *iface)
 
static ULONG WINAPI ddraw_surface3_Release (IDirectDrawSurface3 *iface)
 
static ULONG WINAPI ddraw_surface2_Release (IDirectDrawSurface2 *iface)
 
static ULONG WINAPI ddraw_surface1_Release (IDirectDrawSurface *iface)
 
static ULONG WINAPI ddraw_gamma_control_Release (IDirectDrawGammaControl *iface)
 
static ULONG WINAPI d3d_texture2_Release (IDirect3DTexture2 *iface)
 
static ULONG WINAPI d3d_texture1_Release (IDirect3DTexture *iface)
 
static HRESULT WINAPI ddraw_surface7_GetAttachedSurface (IDirectDrawSurface7 *iface, DDSCAPS2 *Caps, IDirectDrawSurface7 **Surface)
 
static HRESULT WINAPI ddraw_surface4_GetAttachedSurface (IDirectDrawSurface4 *iface, DDSCAPS2 *caps, IDirectDrawSurface4 **attachment)
 
static HRESULT WINAPI ddraw_surface3_GetAttachedSurface (IDirectDrawSurface3 *iface, DDSCAPS *caps, IDirectDrawSurface3 **attachment)
 
static HRESULT WINAPI ddraw_surface2_GetAttachedSurface (IDirectDrawSurface2 *iface, DDSCAPS *caps, IDirectDrawSurface2 **attachment)
 
static HRESULT WINAPI ddraw_surface1_GetAttachedSurface (IDirectDrawSurface *iface, DDSCAPS *caps, IDirectDrawSurface **attachment)
 
static HRESULT surface_lock (struct ddraw_surface *surface, RECT *rect, DDSURFACEDESC2 *surface_desc, unsigned int surface_desc_size, DWORD flags, HANDLE h)
 
static BOOL surface_validate_lock_desc (struct ddraw_surface *surface, const DDSURFACEDESC *desc, unsigned int *size)
 
static HRESULT WINAPI ddraw_surface7_Lock (IDirectDrawSurface7 *iface, RECT *rect, DDSURFACEDESC2 *surface_desc, DWORD flags, HANDLE h)
 
static HRESULT WINAPI ddraw_surface4_Lock (IDirectDrawSurface4 *iface, RECT *rect, DDSURFACEDESC2 *surface_desc, DWORD flags, HANDLE h)
 
static HRESULT WINAPI ddraw_surface3_Lock (IDirectDrawSurface3 *iface, RECT *rect, DDSURFACEDESC *surface_desc, DWORD flags, HANDLE h)
 
static HRESULT WINAPI ddraw_surface2_Lock (IDirectDrawSurface2 *iface, RECT *rect, DDSURFACEDESC *surface_desc, DWORD flags, HANDLE h)
 
static HRESULT WINAPI ddraw_surface1_Lock (IDirectDrawSurface *iface, RECT *rect, DDSURFACEDESC *surface_desc, DWORD flags, HANDLE h)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Unlock (IDirectDrawSurface7 *iface, RECT *pRect)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_Unlock (IDirectDrawSurface4 *iface, RECT *pRect)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_Unlock (IDirectDrawSurface3 *iface, void *data)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_Unlock (IDirectDrawSurface2 *iface, void *data)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Unlock (IDirectDrawSurface *iface, void *data)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip (IDirectDrawSurface7 *iface, IDirectDrawSurface7 *src, DWORD flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_Flip (IDirectDrawSurface4 *iface, IDirectDrawSurface4 *src, DWORD flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_Flip (IDirectDrawSurface3 *iface, IDirectDrawSurface3 *src, DWORD flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_Flip (IDirectDrawSurface2 *iface, IDirectDrawSurface2 *src, DWORD flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Flip (IDirectDrawSurface *iface, IDirectDrawSurface *src, DWORD flags)
 
static HRESULT ddraw_surface_blt (struct ddraw_surface *dst_surface, const RECT *dst_rect, struct ddraw_surface *src_surface, const RECT *src_rect, DWORD flags, DWORD fill_colour, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
 
static HRESULT ddraw_surface_blt_clipped (struct ddraw_surface *dst_surface, const RECT *dst_rect_in, struct ddraw_surface *src_surface, const RECT *src_rect_in, DWORD flags, DWORD fill_colour, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Blt (IDirectDrawSurface7 *iface, RECT *dst_rect, IDirectDrawSurface7 *src_surface, RECT *src_rect, DWORD flags, DDBLTFX *fx)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_Blt (IDirectDrawSurface4 *iface, RECT *dst_rect, IDirectDrawSurface4 *src_surface, RECT *src_rect, DWORD flags, DDBLTFX *fx)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_Blt (IDirectDrawSurface3 *iface, RECT *dst_rect, IDirectDrawSurface3 *src_surface, RECT *src_rect, DWORD flags, DDBLTFX *fx)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_Blt (IDirectDrawSurface2 *iface, RECT *dst_rect, IDirectDrawSurface2 *src_surface, RECT *src_rect, DWORD flags, DDBLTFX *fx)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Blt (IDirectDrawSurface *iface, RECT *dst_rect, IDirectDrawSurface *src_surface, RECT *src_rect, DWORD flags, DDBLTFX *fx)
 
static HRESULT ddraw_surface_attach_surface (struct ddraw_surface *This, struct ddraw_surface *Surf)
 
static HRESULT WINAPI ddraw_surface7_AddAttachedSurface (IDirectDrawSurface7 *iface, IDirectDrawSurface7 *attachment)
 
static HRESULT WINAPI ddraw_surface4_AddAttachedSurface (IDirectDrawSurface4 *iface, IDirectDrawSurface4 *attachment)
 
static HRESULT WINAPI ddraw_surface3_AddAttachedSurface (IDirectDrawSurface3 *iface, IDirectDrawSurface3 *attachment)
 
static HRESULT WINAPI ddraw_surface2_AddAttachedSurface (IDirectDrawSurface2 *iface, IDirectDrawSurface2 *attachment)
 
static HRESULT WINAPI ddraw_surface1_AddAttachedSurface (IDirectDrawSurface *iface, IDirectDrawSurface *attachment)
 
static HRESULT ddraw_surface_delete_attached_surface (struct ddraw_surface *surface, struct ddraw_surface *attachment, IUnknown *detach_iface)
 
static HRESULT WINAPI ddraw_surface7_DeleteAttachedSurface (IDirectDrawSurface7 *iface, DWORD flags, IDirectDrawSurface7 *attachment)
 
static HRESULT WINAPI ddraw_surface4_DeleteAttachedSurface (IDirectDrawSurface4 *iface, DWORD flags, IDirectDrawSurface4 *attachment)
 
static HRESULT WINAPI ddraw_surface3_DeleteAttachedSurface (IDirectDrawSurface3 *iface, DWORD flags, IDirectDrawSurface3 *attachment)
 
static HRESULT WINAPI ddraw_surface2_DeleteAttachedSurface (IDirectDrawSurface2 *iface, DWORD flags, IDirectDrawSurface2 *attachment)
 
static HRESULT WINAPI ddraw_surface1_DeleteAttachedSurface (IDirectDrawSurface *iface, DWORD flags, IDirectDrawSurface *attachment)
 
static HRESULT WINAPI ddraw_surface7_AddOverlayDirtyRect (IDirectDrawSurface7 *iface, RECT *Rect)
 
static HRESULT WINAPI ddraw_surface4_AddOverlayDirtyRect (IDirectDrawSurface4 *iface, RECT *rect)
 
static HRESULT WINAPI ddraw_surface3_AddOverlayDirtyRect (IDirectDrawSurface3 *iface, RECT *rect)
 
static HRESULT WINAPI ddraw_surface2_AddOverlayDirtyRect (IDirectDrawSurface2 *iface, RECT *rect)
 
static HRESULT WINAPI ddraw_surface1_AddOverlayDirtyRect (IDirectDrawSurface *iface, RECT *rect)
 
static HRESULT WINAPI ddraw_surface7_GetDC (IDirectDrawSurface7 *iface, HDC *dc)
 
static HRESULT WINAPI ddraw_surface4_GetDC (IDirectDrawSurface4 *iface, HDC *dc)
 
static HRESULT WINAPI ddraw_surface3_GetDC (IDirectDrawSurface3 *iface, HDC *dc)
 
static HRESULT WINAPI ddraw_surface2_GetDC (IDirectDrawSurface2 *iface, HDC *dc)
 
static HRESULT WINAPI ddraw_surface1_GetDC (IDirectDrawSurface *iface, HDC *dc)
 
static HRESULT WINAPI ddraw_surface7_ReleaseDC (IDirectDrawSurface7 *iface, HDC hdc)
 
static HRESULT WINAPI ddraw_surface4_ReleaseDC (IDirectDrawSurface4 *iface, HDC dc)
 
static HRESULT WINAPI ddraw_surface3_ReleaseDC (IDirectDrawSurface3 *iface, HDC dc)
 
static HRESULT WINAPI ddraw_surface2_ReleaseDC (IDirectDrawSurface2 *iface, HDC dc)
 
static HRESULT WINAPI ddraw_surface1_ReleaseDC (IDirectDrawSurface *iface, HDC dc)
 
static HRESULT WINAPI ddraw_surface7_GetCaps (IDirectDrawSurface7 *iface, DDSCAPS2 *Caps)
 
static HRESULT WINAPI ddraw_surface4_GetCaps (IDirectDrawSurface4 *iface, DDSCAPS2 *caps)
 
static HRESULT WINAPI ddraw_surface3_GetCaps (IDirectDrawSurface3 *iface, DDSCAPS *caps)
 
static HRESULT WINAPI ddraw_surface2_GetCaps (IDirectDrawSurface2 *iface, DDSCAPS *caps)
 
static HRESULT WINAPI ddraw_surface1_GetCaps (IDirectDrawSurface *iface, DDSCAPS *caps)
 
static HRESULT WINAPI ddraw_surface7_SetPriority (IDirectDrawSurface7 *iface, DWORD priority)
 
static HRESULT WINAPI ddraw_surface7_GetPriority (IDirectDrawSurface7 *iface, DWORD *priority)
 
static HRESULT WINAPI ddraw_surface7_SetPrivateData (IDirectDrawSurface7 *iface, REFGUID tag, void *data, DWORD size, DWORD flags)
 
static HRESULT WINAPI ddraw_surface4_SetPrivateData (IDirectDrawSurface4 *iface, REFGUID tag, void *data, DWORD size, DWORD flags)
 
static HRESULT WINAPI ddraw_surface7_GetPrivateData (IDirectDrawSurface7 *iface, REFGUID tag, void *data, DWORD *size)
 
static HRESULT WINAPI ddraw_surface4_GetPrivateData (IDirectDrawSurface4 *iface, REFGUID tag, void *data, DWORD *size)
 
static HRESULT WINAPI ddraw_surface7_FreePrivateData (IDirectDrawSurface7 *iface, REFGUID tag)
 
static HRESULT WINAPI ddraw_surface4_FreePrivateData (IDirectDrawSurface4 *iface, REFGUID tag)
 
static HRESULT WINAPI ddraw_surface7_PageLock (IDirectDrawSurface7 *iface, DWORD Flags)
 
static HRESULT WINAPI ddraw_surface4_PageLock (IDirectDrawSurface4 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface3_PageLock (IDirectDrawSurface3 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface2_PageLock (IDirectDrawSurface2 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface7_PageUnlock (IDirectDrawSurface7 *iface, DWORD Flags)
 
static HRESULT WINAPI ddraw_surface4_PageUnlock (IDirectDrawSurface4 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface3_PageUnlock (IDirectDrawSurface3 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface2_PageUnlock (IDirectDrawSurface2 *iface, DWORD flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_BltBatch (IDirectDrawSurface7 *iface, DDBLTBATCH *Batch, DWORD Count, DWORD Flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_BltBatch (IDirectDrawSurface4 *iface, DDBLTBATCH *batch, DWORD count, DWORD flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_BltBatch (IDirectDrawSurface3 *iface, DDBLTBATCH *batch, DWORD count, DWORD flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_BltBatch (IDirectDrawSurface2 *iface, DDBLTBATCH *batch, DWORD count, DWORD flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_BltBatch (IDirectDrawSurface *iface, DDBLTBATCH *batch, DWORD count, DWORD flags)
 
static HRESULT WINAPI ddraw_surface7_EnumAttachedSurfaces (IDirectDrawSurface7 *iface, void *context, LPDDENUMSURFACESCALLBACK7 cb)
 
static HRESULT CALLBACK EnumCallback2 (IDirectDrawSurface7 *surface, DDSURFACEDESC2 *surface_desc, void *context)
 
static HRESULT CALLBACK EnumCallback (IDirectDrawSurface7 *surface, DDSURFACEDESC2 *surface_desc, void *context)
 
static HRESULT WINAPI ddraw_surface4_EnumAttachedSurfaces (IDirectDrawSurface4 *iface, void *context, LPDDENUMSURFACESCALLBACK2 callback)
 
static HRESULT WINAPI ddraw_surface3_EnumAttachedSurfaces (IDirectDrawSurface3 *iface, void *context, LPDDENUMSURFACESCALLBACK callback)
 
static HRESULT WINAPI ddraw_surface2_EnumAttachedSurfaces (IDirectDrawSurface2 *iface, void *context, LPDDENUMSURFACESCALLBACK callback)
 
static HRESULT WINAPI ddraw_surface1_EnumAttachedSurfaces (IDirectDrawSurface *iface, void *context, LPDDENUMSURFACESCALLBACK callback)
 
static HRESULT WINAPI ddraw_surface7_EnumOverlayZOrders (IDirectDrawSurface7 *iface, DWORD Flags, void *context, LPDDENUMSURFACESCALLBACK7 cb)
 
static HRESULT WINAPI ddraw_surface4_EnumOverlayZOrders (IDirectDrawSurface4 *iface, DWORD flags, void *context, LPDDENUMSURFACESCALLBACK2 callback)
 
static HRESULT WINAPI ddraw_surface3_EnumOverlayZOrders (IDirectDrawSurface3 *iface, DWORD flags, void *context, LPDDENUMSURFACESCALLBACK callback)
 
static HRESULT WINAPI ddraw_surface2_EnumOverlayZOrders (IDirectDrawSurface2 *iface, DWORD flags, void *context, LPDDENUMSURFACESCALLBACK callback)
 
static HRESULT WINAPI ddraw_surface1_EnumOverlayZOrders (IDirectDrawSurface *iface, DWORD flags, void *context, LPDDENUMSURFACESCALLBACK callback)
 
static HRESULT WINAPI ddraw_surface7_GetBltStatus (IDirectDrawSurface7 *iface, DWORD Flags)
 
static HRESULT WINAPI ddraw_surface4_GetBltStatus (IDirectDrawSurface4 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface3_GetBltStatus (IDirectDrawSurface3 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface2_GetBltStatus (IDirectDrawSurface2 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface1_GetBltStatus (IDirectDrawSurface *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface7_GetColorKey (IDirectDrawSurface7 *iface, DWORD Flags, DDCOLORKEY *CKey)
 
static HRESULT WINAPI ddraw_surface4_GetColorKey (IDirectDrawSurface4 *iface, DWORD flags, DDCOLORKEY *color_key)
 
static HRESULT WINAPI ddraw_surface3_GetColorKey (IDirectDrawSurface3 *iface, DWORD flags, DDCOLORKEY *color_key)
 
static HRESULT WINAPI ddraw_surface2_GetColorKey (IDirectDrawSurface2 *iface, DWORD flags, DDCOLORKEY *color_key)
 
static HRESULT WINAPI ddraw_surface1_GetColorKey (IDirectDrawSurface *iface, DWORD flags, DDCOLORKEY *color_key)
 
static HRESULT WINAPI ddraw_surface7_GetFlipStatus (IDirectDrawSurface7 *iface, DWORD Flags)
 
static HRESULT WINAPI ddraw_surface4_GetFlipStatus (IDirectDrawSurface4 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface3_GetFlipStatus (IDirectDrawSurface3 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface2_GetFlipStatus (IDirectDrawSurface2 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface1_GetFlipStatus (IDirectDrawSurface *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface7_GetOverlayPosition (IDirectDrawSurface7 *iface, LONG *x, LONG *y)
 
static HRESULT WINAPI ddraw_surface4_GetOverlayPosition (IDirectDrawSurface4 *iface, LONG *x, LONG *y)
 
static HRESULT WINAPI ddraw_surface3_GetOverlayPosition (IDirectDrawSurface3 *iface, LONG *x, LONG *y)
 
static HRESULT WINAPI ddraw_surface2_GetOverlayPosition (IDirectDrawSurface2 *iface, LONG *x, LONG *y)
 
static HRESULT WINAPI ddraw_surface1_GetOverlayPosition (IDirectDrawSurface *iface, LONG *x, LONG *y)
 
static HRESULT WINAPI ddraw_surface7_GetPixelFormat (IDirectDrawSurface7 *iface, DDPIXELFORMAT *PixelFormat)
 
static HRESULT WINAPI ddraw_surface4_GetPixelFormat (IDirectDrawSurface4 *iface, DDPIXELFORMAT *pixel_format)
 
static HRESULT WINAPI ddraw_surface3_GetPixelFormat (IDirectDrawSurface3 *iface, DDPIXELFORMAT *pixel_format)
 
static HRESULT WINAPI ddraw_surface2_GetPixelFormat (IDirectDrawSurface2 *iface, DDPIXELFORMAT *pixel_format)
 
static HRESULT WINAPI ddraw_surface1_GetPixelFormat (IDirectDrawSurface *iface, DDPIXELFORMAT *pixel_format)
 
static HRESULT WINAPI ddraw_surface7_GetSurfaceDesc (IDirectDrawSurface7 *iface, DDSURFACEDESC2 *DDSD)
 
static HRESULT WINAPI ddraw_surface4_GetSurfaceDesc (IDirectDrawSurface4 *iface, DDSURFACEDESC2 *DDSD)
 
static HRESULT WINAPI ddraw_surface3_GetSurfaceDesc (IDirectDrawSurface3 *iface, DDSURFACEDESC *surface_desc)
 
static HRESULT WINAPI ddraw_surface2_GetSurfaceDesc (IDirectDrawSurface2 *iface, DDSURFACEDESC *DDSD)
 
static HRESULT WINAPI ddraw_surface1_GetSurfaceDesc (IDirectDrawSurface *iface, DDSURFACEDESC *DDSD)
 
static HRESULT WINAPI ddraw_surface7_Initialize (IDirectDrawSurface7 *iface, IDirectDraw *ddraw, DDSURFACEDESC2 *surface_desc)
 
static HRESULT WINAPI ddraw_surface4_Initialize (IDirectDrawSurface4 *iface, IDirectDraw *ddraw, DDSURFACEDESC2 *surface_desc)
 
static HRESULT WINAPI ddraw_surface3_Initialize (IDirectDrawSurface3 *iface, IDirectDraw *ddraw, DDSURFACEDESC *surface_desc)
 
static HRESULT WINAPI ddraw_surface2_Initialize (IDirectDrawSurface2 *iface, IDirectDraw *ddraw, DDSURFACEDESC *surface_desc)
 
static HRESULT WINAPI ddraw_surface1_Initialize (IDirectDrawSurface *iface, IDirectDraw *ddraw, DDSURFACEDESC *surface_desc)
 
static HRESULT WINAPI d3d_texture1_Initialize (IDirect3DTexture *iface, IDirect3DDevice *device, IDirectDrawSurface *surface)
 
static HRESULT WINAPI ddraw_surface7_IsLost (IDirectDrawSurface7 *iface)
 
static HRESULT WINAPI ddraw_surface4_IsLost (IDirectDrawSurface4 *iface)
 
static HRESULT WINAPI ddraw_surface3_IsLost (IDirectDrawSurface3 *iface)
 
static HRESULT WINAPI ddraw_surface2_IsLost (IDirectDrawSurface2 *iface)
 
static HRESULT WINAPI ddraw_surface1_IsLost (IDirectDrawSurface *iface)
 
static HRESULT WINAPI ddraw_surface7_Restore (IDirectDrawSurface7 *iface)
 
static HRESULT WINAPI ddraw_surface4_Restore (IDirectDrawSurface4 *iface)
 
static HRESULT WINAPI ddraw_surface3_Restore (IDirectDrawSurface3 *iface)
 
static HRESULT WINAPI ddraw_surface2_Restore (IDirectDrawSurface2 *iface)
 
static HRESULT WINAPI ddraw_surface1_Restore (IDirectDrawSurface *iface)
 
static HRESULT WINAPI ddraw_surface7_SetOverlayPosition (IDirectDrawSurface7 *iface, LONG x, LONG y)
 
static HRESULT WINAPI ddraw_surface4_SetOverlayPosition (IDirectDrawSurface4 *iface, LONG x, LONG y)
 
static HRESULT WINAPI ddraw_surface3_SetOverlayPosition (IDirectDrawSurface3 *iface, LONG x, LONG y)
 
static HRESULT WINAPI ddraw_surface2_SetOverlayPosition (IDirectDrawSurface2 *iface, LONG x, LONG y)
 
static HRESULT WINAPI ddraw_surface1_SetOverlayPosition (IDirectDrawSurface *iface, LONG x, LONG y)
 
static HRESULT WINAPI ddraw_surface7_UpdateOverlay (IDirectDrawSurface7 *iface, RECT *src_rect, IDirectDrawSurface7 *dst_surface, RECT *dst_rect, DWORD flags, DDOVERLAYFX *fx)
 
static HRESULT WINAPI ddraw_surface4_UpdateOverlay (IDirectDrawSurface4 *iface, RECT *src_rect, IDirectDrawSurface4 *dst_surface, RECT *dst_rect, DWORD flags, DDOVERLAYFX *fx)
 
static HRESULT WINAPI ddraw_surface3_UpdateOverlay (IDirectDrawSurface3 *iface, RECT *src_rect, IDirectDrawSurface3 *dst_surface, RECT *dst_rect, DWORD flags, DDOVERLAYFX *fx)
 
static HRESULT WINAPI ddraw_surface2_UpdateOverlay (IDirectDrawSurface2 *iface, RECT *src_rect, IDirectDrawSurface2 *dst_surface, RECT *dst_rect, DWORD flags, DDOVERLAYFX *fx)
 
static HRESULT WINAPI ddraw_surface1_UpdateOverlay (IDirectDrawSurface *iface, RECT *src_rect, IDirectDrawSurface *dst_surface, RECT *dst_rect, DWORD flags, DDOVERLAYFX *fx)
 
static HRESULT WINAPI ddraw_surface7_UpdateOverlayDisplay (IDirectDrawSurface7 *iface, DWORD Flags)
 
static HRESULT WINAPI ddraw_surface4_UpdateOverlayDisplay (IDirectDrawSurface4 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface3_UpdateOverlayDisplay (IDirectDrawSurface3 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface2_UpdateOverlayDisplay (IDirectDrawSurface2 *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface1_UpdateOverlayDisplay (IDirectDrawSurface *iface, DWORD flags)
 
static HRESULT WINAPI ddraw_surface7_UpdateOverlayZOrder (IDirectDrawSurface7 *iface, DWORD flags, IDirectDrawSurface7 *reference)
 
static HRESULT WINAPI ddraw_surface4_UpdateOverlayZOrder (IDirectDrawSurface4 *iface, DWORD flags, IDirectDrawSurface4 *reference)
 
static HRESULT WINAPI ddraw_surface3_UpdateOverlayZOrder (IDirectDrawSurface3 *iface, DWORD flags, IDirectDrawSurface3 *reference)
 
static HRESULT WINAPI ddraw_surface2_UpdateOverlayZOrder (IDirectDrawSurface2 *iface, DWORD flags, IDirectDrawSurface2 *reference)
 
static HRESULT WINAPI ddraw_surface1_UpdateOverlayZOrder (IDirectDrawSurface *iface, DWORD flags, IDirectDrawSurface *reference)
 
static HRESULT WINAPI ddraw_surface7_GetDDInterface (IDirectDrawSurface7 *iface, void **DD)
 
static HRESULT WINAPI ddraw_surface4_GetDDInterface (IDirectDrawSurface4 *iface, void **ddraw)
 
static HRESULT WINAPI ddraw_surface3_GetDDInterface (IDirectDrawSurface3 *iface, void **ddraw)
 
static HRESULT WINAPI ddraw_surface2_GetDDInterface (IDirectDrawSurface2 *iface, void **ddraw)
 
static HRESULT WINAPI ddraw_surface7_ChangeUniquenessValue (IDirectDrawSurface7 *iface)
 
static HRESULT WINAPI ddraw_surface4_ChangeUniquenessValue (IDirectDrawSurface4 *iface)
 
static HRESULT WINAPI ddraw_surface7_GetUniquenessValue (IDirectDrawSurface7 *iface, DWORD *pValue)
 
static HRESULT WINAPI ddraw_surface4_GetUniquenessValue (IDirectDrawSurface4 *iface, DWORD *pValue)
 
static HRESULT WINAPI ddraw_surface7_SetLOD (IDirectDrawSurface7 *iface, DWORD MaxLOD)
 
static HRESULT WINAPI ddraw_surface7_GetLOD (IDirectDrawSurface7 *iface, DWORD *MaxLOD)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_BltFast (IDirectDrawSurface7 *iface, DWORD dst_x, DWORD dst_y, IDirectDrawSurface7 *src_surface, RECT *src_rect, DWORD trans)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_BltFast (IDirectDrawSurface4 *iface, DWORD dst_x, DWORD dst_y, IDirectDrawSurface4 *src_surface, RECT *src_rect, DWORD flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_BltFast (IDirectDrawSurface3 *iface, DWORD dst_x, DWORD dst_y, IDirectDrawSurface3 *src_surface, RECT *src_rect, DWORD flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_BltFast (IDirectDrawSurface2 *iface, DWORD dst_x, DWORD dst_y, IDirectDrawSurface2 *src_surface, RECT *src_rect, DWORD flags)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_BltFast (IDirectDrawSurface *iface, DWORD dst_x, DWORD dst_y, IDirectDrawSurface *src_surface, RECT *src_rect, DWORD flags)
 
static HRESULT WINAPI ddraw_surface7_GetClipper (IDirectDrawSurface7 *iface, IDirectDrawClipper **Clipper)
 
static HRESULT WINAPI ddraw_surface4_GetClipper (IDirectDrawSurface4 *iface, IDirectDrawClipper **clipper)
 
static HRESULT WINAPI ddraw_surface3_GetClipper (IDirectDrawSurface3 *iface, IDirectDrawClipper **clipper)
 
static HRESULT WINAPI ddraw_surface2_GetClipper (IDirectDrawSurface2 *iface, IDirectDrawClipper **clipper)
 
static HRESULT WINAPI ddraw_surface1_GetClipper (IDirectDrawSurface *iface, IDirectDrawClipper **clipper)
 
static HRESULT WINAPI ddraw_surface7_SetClipper (IDirectDrawSurface7 *iface, IDirectDrawClipper *iclipper)
 
static HRESULT WINAPI ddraw_surface4_SetClipper (IDirectDrawSurface4 *iface, IDirectDrawClipper *clipper)
 
static HRESULT WINAPI ddraw_surface3_SetClipper (IDirectDrawSurface3 *iface, IDirectDrawClipper *clipper)
 
static HRESULT WINAPI ddraw_surface2_SetClipper (IDirectDrawSurface2 *iface, IDirectDrawClipper *clipper)
 
static HRESULT WINAPI ddraw_surface1_SetClipper (IDirectDrawSurface *iface, IDirectDrawClipper *clipper)
 
static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc (IDirectDrawSurface7 *iface, DDSURFACEDESC2 *DDSD, DWORD Flags)
 
static HRESULT WINAPI ddraw_surface4_SetSurfaceDesc (IDirectDrawSurface4 *iface, DDSURFACEDESC2 *surface_desc, DWORD flags)
 
static HRESULT WINAPI ddraw_surface3_SetSurfaceDesc (IDirectDrawSurface3 *iface, DDSURFACEDESC *surface_desc, DWORD flags)
 
static HRESULT WINAPI ddraw_surface7_GetPalette (IDirectDrawSurface7 *iface, IDirectDrawPalette **palette)
 
static HRESULT WINAPI ddraw_surface4_GetPalette (IDirectDrawSurface4 *iface, IDirectDrawPalette **palette)
 
static HRESULT WINAPI ddraw_surface3_GetPalette (IDirectDrawSurface3 *iface, IDirectDrawPalette **palette)
 
static HRESULT WINAPI ddraw_surface2_GetPalette (IDirectDrawSurface2 *iface, IDirectDrawPalette **palette)
 
static HRESULT WINAPI ddraw_surface1_GetPalette (IDirectDrawSurface *iface, IDirectDrawPalette **palette)
 
static HRESULT ddraw_surface_set_color_key (struct ddraw_surface *surface, DWORD flags, DDCOLORKEY *color_key)
 
static HRESULT WINAPI ddraw_surface7_SetColorKey (IDirectDrawSurface7 *iface, DWORD flags, DDCOLORKEY *color_key)
 
static HRESULT WINAPI ddraw_surface4_SetColorKey (IDirectDrawSurface4 *iface, DWORD flags, DDCOLORKEY *color_key)
 
static HRESULT WINAPI ddraw_surface3_SetColorKey (IDirectDrawSurface3 *iface, DWORD flags, DDCOLORKEY *color_key)
 
static HRESULT WINAPI ddraw_surface2_SetColorKey (IDirectDrawSurface2 *iface, DWORD flags, DDCOLORKEY *color_key)
 
static HRESULT WINAPI ddraw_surface1_SetColorKey (IDirectDrawSurface *iface, DWORD flags, DDCOLORKEY *color_key)
 
static HRESULT WINAPI ddraw_surface7_SetPalette (IDirectDrawSurface7 *iface, IDirectDrawPalette *palette)
 
static HRESULT WINAPI ddraw_surface4_SetPalette (IDirectDrawSurface4 *iface, IDirectDrawPalette *palette)
 
static HRESULT WINAPI ddraw_surface3_SetPalette (IDirectDrawSurface3 *iface, IDirectDrawPalette *palette)
 
static HRESULT WINAPI ddraw_surface2_SetPalette (IDirectDrawSurface2 *iface, IDirectDrawPalette *palette)
 
static HRESULT WINAPI ddraw_surface1_SetPalette (IDirectDrawSurface *iface, IDirectDrawPalette *palette)
 
static HRESULT WINAPI ddraw_gamma_control_GetGammaRamp (IDirectDrawGammaControl *iface, DWORD flags, DDGAMMARAMP *gamma_ramp)
 
static HRESULT WINAPI ddraw_gamma_control_SetGammaRamp (IDirectDrawGammaControl *iface, DWORD flags, DDGAMMARAMP *gamma_ramp)
 
static HRESULT WINAPI d3d_texture2_PaletteChanged (IDirect3DTexture2 *iface, DWORD start, DWORD count)
 
static HRESULT WINAPI d3d_texture1_PaletteChanged (IDirect3DTexture *iface, DWORD start, DWORD count)
 
static HRESULT WINAPI d3d_texture1_Unload (IDirect3DTexture *iface)
 
static HRESULT WINAPI d3d_texture2_GetHandle (IDirect3DTexture2 *iface, IDirect3DDevice2 *device, D3DTEXTUREHANDLE *handle)
 
static HRESULT WINAPI d3d_texture1_GetHandle (IDirect3DTexture *iface, IDirect3DDevice *device, D3DTEXTUREHANDLE *handle)
 
static struct ddraw_surfaceget_sub_mimaplevel (struct ddraw_surface *surface)
 
static BOOL compare_format (DDPIXELFORMAT *format1, DDPIXELFORMAT *format2)
 
static HRESULT WINAPI d3d_texture2_Load (IDirect3DTexture2 *iface, IDirect3DTexture2 *src_texture)
 
static HRESULT WINAPI d3d_texture1_Load (IDirect3DTexture *iface, IDirect3DTexture *src_texture)
 
struct ddraw_surfaceunsafe_impl_from_IDirectDrawSurface7 (IDirectDrawSurface7 *iface)
 
struct ddraw_surfaceunsafe_impl_from_IDirectDrawSurface4 (IDirectDrawSurface4 *iface)
 
struct ddraw_surfaceunsafe_impl_from_IDirectDrawSurface (IDirectDrawSurface *iface)
 
struct ddraw_surfaceunsafe_impl_from_IDirect3DTexture2 (IDirect3DTexture2 *iface)
 
struct ddraw_surfaceunsafe_impl_from_IDirect3DTexture (IDirect3DTexture *iface)
 
static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed (void *parent)
 
static void STDMETHODCALLTYPE ddraw_texture_wined3d_object_destroyed (void *parent)
 
static HRESULT CDECL ddraw_reset_enum_callback (struct wined3d_resource *resource)
 
HRESULT ddraw_surface_create (struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc, struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version)
 
void ddraw_surface_init (struct ddraw_surface *surface, struct ddraw *ddraw, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops)
 
static void STDMETHODCALLTYPE view_wined3d_object_destroyed (void *parent)
 
struct wined3d_rendertarget_viewddraw_surface_get_rendertarget_view (struct ddraw_surface *surface)
 

Variables

static const struct IDirectDrawSurface7Vtbl ddraw_surface7_vtbl
 
static const struct IDirectDrawSurface4Vtbl ddraw_surface4_vtbl
 
static const struct IDirectDrawSurface3Vtbl ddraw_surface3_vtbl
 
static const struct IDirectDrawSurface2Vtbl ddraw_surface2_vtbl
 
static struct IDirectDrawSurfaceVtbl ddraw_surface1_vtbl
 
static const struct IDirectDrawGammaControlVtbl ddraw_gamma_control_vtbl
 
static const struct IDirect3DTexture2Vtbl d3d_texture2_vtbl
 
static const struct IDirect3DTextureVtbl d3d_texture1_vtbl
 
static const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops
 
static const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops
 
static const struct wined3d_parent_ops ddraw_view_wined3d_parent_ops
 

Function Documentation

◆ compare_format()

static BOOL compare_format ( DDPIXELFORMAT format1,
DDPIXELFORMAT format2 
)
static

Definition at line 5192 of file surface.c.

5193{
5194 if ((format1->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_FOURCC)) !=
5195 (format2->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_FOURCC)))
5196 return FALSE;
5197
5198 if (format1->dwFlags & (DDPF_RGB|DDPF_YUV))
5199 {
5200 if (!(format1->dwFlags & DDPF_ALPHA))
5201 {
5202 /* The RGB and YUV bits are stored in the same fields */
5203 if (format1->u1.dwRGBBitCount != format2->u1.dwRGBBitCount)
5204 return FALSE;
5205
5206 if (format1->u2.dwRBitMask != format2->u2.dwRBitMask)
5207 return FALSE;
5208
5209 if (format1->u3.dwGBitMask != format2->u3.dwGBitMask)
5210 return FALSE;
5211
5212 if (format1->u4.dwBBitMask != format2->u4.dwBBitMask)
5213 return FALSE;
5214 }
5215
5216 if (format1->dwFlags & (DDPF_ALPHAPIXELS | DDPF_ALPHA))
5217 {
5218 if (format1->u5.dwRGBAlphaBitMask != format2->u5.dwRGBAlphaBitMask)
5219 return FALSE;
5220 }
5221 }
5222
5223 if (format1->dwFlags & DDPF_FOURCC)
5224 {
5225 if (format1->dwFourCC != format2->dwFourCC)
5226 return FALSE;
5227 }
5228
5229 return TRUE;
5230}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DDPF_ALPHA
Definition: ddraw.h:502
#define DDPF_YUV
Definition: ddraw.h:510
#define DDPF_FOURCC
Definition: ddraw.h:503
#define DDPF_RGB
Definition: ddraw.h:507
#define DDPF_ALPHAPIXELS
Definition: ddraw.h:501
DWORD dwBBitMask
Definition: ddraw.h:1106
DWORD dwFourCC
Definition: ddraw.h:1072
DWORD dwRGBBitCount
Definition: ddraw.h:1075
DWORD dwRBitMask
Definition: ddraw.h:1085
DWORD dwGBitMask
Definition: ddraw.h:1094
DWORD dwFlags
Definition: ddraw.h:1071
DWORD dwRGBAlphaBitMask
Definition: ddraw.h:1113

Referenced by d3d_texture2_Load().

◆ d3d_texture1_AddRef()

static ULONG WINAPI d3d_texture1_AddRef ( IDirect3DTexture *  iface)
static

Definition at line 440 of file surface.c.

441{
442 struct ddraw_surface *surface = impl_from_IDirect3DTexture(iface);
443
444 TRACE("iface %p.\n", iface);
445
446 return IUnknown_AddRef(surface->texture_outer);
447}
static struct ddraw_surface * impl_from_IDirect3DTexture(IDirect3DTexture *iface)
#define TRACE(s)
Definition: solgame.cpp:4
IUnknown * texture_outer

◆ d3d_texture1_GetHandle()

static HRESULT WINAPI d3d_texture1_GetHandle ( IDirect3DTexture *  iface,
IDirect3DDevice *  device,
D3DTEXTUREHANDLE handle 
)
static

Definition at line 5157 of file surface.c.

5159{
5160 struct ddraw_surface *surface = impl_from_IDirect3DTexture(iface);
5161 struct d3d_device *device_impl = unsafe_impl_from_IDirect3DDevice(device);
5162
5163 TRACE("iface %p, device %p, handle %p.\n", iface, device, handle);
5164
5166 device_impl ? &device_impl->IDirect3DDevice2_iface : NULL, handle);
5167}
struct d3d_device * unsafe_impl_from_IDirect3DDevice(IDirect3DDevice *iface) DECLSPEC_HIDDEN
Definition: device.c:6871
#define NULL
Definition: types.h:112
static HRESULT WINAPI d3d_texture2_GetHandle(IDirect3DTexture2 *iface, IDirect3DDevice2 *device, D3DTEXTUREHANDLE *handle)
Definition: surface.c:5126
IDirect3DDevice2 IDirect3DDevice2_iface
IDirect3DTexture2 IDirect3DTexture2_iface
Definition: devices.h:37

◆ d3d_texture1_Initialize()

static HRESULT WINAPI d3d_texture1_Initialize ( IDirect3DTexture *  iface,
IDirect3DDevice *  device,
IDirectDrawSurface *  surface 
)
static

Definition at line 3594 of file surface.c.

3596{
3597 TRACE("iface %p, device %p, surface %p.\n", iface, device, surface);
3598
3599 return DDERR_UNSUPPORTED; /* Unchecked */
3600}
#define DDERR_UNSUPPORTED
Definition: ddraw.h:127

◆ d3d_texture1_Load()

static HRESULT WINAPI d3d_texture1_Load ( IDirect3DTexture *  iface,
IDirect3DTexture *  src_texture 
)
static

Definition at line 5344 of file surface.c.

5345{
5346 struct ddraw_surface *dst_surface = impl_from_IDirect3DTexture(iface);
5347 struct ddraw_surface *src_surface = unsafe_impl_from_IDirect3DTexture(src_texture);
5348
5349 TRACE("iface %p, src_texture %p.\n", iface, src_texture);
5350
5351 return d3d_texture2_Load(&dst_surface->IDirect3DTexture2_iface,
5352 src_surface ? &src_surface->IDirect3DTexture2_iface : NULL);
5353}
static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTexture2 *src_texture)
Definition: surface.c:5249
struct ddraw_surface * unsafe_impl_from_IDirect3DTexture(IDirect3DTexture *iface)
Definition: surface.c:5728

◆ d3d_texture1_PaletteChanged()

static HRESULT WINAPI d3d_texture1_PaletteChanged ( IDirect3DTexture *  iface,
DWORD  start,
DWORD  count 
)
static

Definition at line 5087 of file surface.c.

5088{
5089 struct ddraw_surface *surface = impl_from_IDirect3DTexture(iface);
5090
5091 TRACE("iface %p, start %u, count %u.\n", iface, start, count);
5092
5094}
static HRESULT WINAPI d3d_texture2_PaletteChanged(IDirect3DTexture2 *iface, DWORD start, DWORD count)
Definition: surface.c:5080
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545

◆ d3d_texture1_QueryInterface()

static HRESULT WINAPI d3d_texture1_QueryInterface ( IDirect3DTexture *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 306 of file surface.c.

307{
308 struct ddraw_surface *surface = impl_from_IDirect3DTexture(iface);
309
310 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
311
313}
static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface, REFIID riid, void **obj)
Definition: surface.c:133
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
IDirectDrawSurface7 IDirectDrawSurface7_iface

◆ d3d_texture1_Release()

static ULONG WINAPI d3d_texture1_Release ( IDirect3DTexture *  iface)
static

Definition at line 700 of file surface.c.

701{
702 struct ddraw_surface *surface = impl_from_IDirect3DTexture(iface);
703
704 TRACE("iface %p.\n", iface);
705
706 return IUnknown_Release(surface->texture_outer);
707}

◆ d3d_texture1_Unload()

static HRESULT WINAPI d3d_texture1_Unload ( IDirect3DTexture *  iface)
static

Definition at line 5106 of file surface.c.

5107{
5108 WARN("iface %p. Not implemented.\n", iface);
5109
5110 return DDERR_UNSUPPORTED;
5111}
#define WARN(fmt,...)
Definition: precomp.h:61

◆ d3d_texture2_AddRef()

static ULONG WINAPI d3d_texture2_AddRef ( IDirect3DTexture2 *  iface)
static

Definition at line 431 of file surface.c.

432{
433 struct ddraw_surface *surface = impl_from_IDirect3DTexture2(iface);
434
435 TRACE("iface %p.\n", iface);
436
437 return IUnknown_AddRef(surface->texture_outer);
438}
static struct ddraw_surface * impl_from_IDirect3DTexture2(IDirect3DTexture2 *iface)

◆ d3d_texture2_GetHandle()

static HRESULT WINAPI d3d_texture2_GetHandle ( IDirect3DTexture2 *  iface,
IDirect3DDevice2 *  device,
D3DTEXTUREHANDLE handle 
)
static

Definition at line 5126 of file surface.c.

5128{
5129 struct ddraw_surface *surface = impl_from_IDirect3DTexture2(iface);
5131
5132 TRACE("iface %p, device %p, handle %p.\n", iface, device, handle);
5133
5135
5136 if (!surface->Handle)
5137 {
5139 if (h == DDRAW_INVALID_HANDLE)
5140 {
5141 ERR("Failed to allocate a texture handle.\n");
5143 return DDERR_OUTOFMEMORY;
5144 }
5145
5146 surface->Handle = h + 1;
5147 }
5148
5149 TRACE("Returning handle %08x.\n", surface->Handle);
5150 *handle = surface->Handle;
5151
5153
5154 return D3D_OK;
5155}
#define ERR(fmt,...)
Definition: precomp.h:57
#define D3D_OK
Definition: d3d.h:106
DWORD ddraw_allocate_handle(struct ddraw_handle_table *t, void *object, enum ddraw_handle_type type) DECLSPEC_HIDDEN
Definition: main.c:113
struct d3d_device * unsafe_impl_from_IDirect3DDevice2(IDirect3DDevice2 *iface) DECLSPEC_HIDDEN
Definition: device.c:6864
#define DDRAW_INVALID_HANDLE
@ DDRAW_HANDLE_SURFACE
unsigned long DWORD
Definition: ntddk_ex.h:95
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define DDERR_OUTOFMEMORY
Definition: ddraw.h:111
struct ddraw_handle_table handle_table
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368

Referenced by d3d_texture1_GetHandle().

◆ d3d_texture2_Load()

static HRESULT WINAPI d3d_texture2_Load ( IDirect3DTexture2 *  iface,
IDirect3DTexture2 *  src_texture 
)
static

Definition at line 5249 of file surface.c.

5250{
5251 struct ddraw_surface *dst_surface = impl_from_IDirect3DTexture2(iface);
5252 struct ddraw_surface *src_surface = unsafe_impl_from_IDirect3DTexture2(src_texture);
5253 RECT src_rect, dst_rect;
5254 HRESULT hr;
5255
5256 TRACE("iface %p, src_texture %p.\n", iface, src_texture);
5257
5258 if (src_surface == dst_surface)
5259 {
5260 TRACE("copying surface %p to surface %p, why?\n", src_surface, dst_surface);
5261 return D3D_OK;
5262 }
5263
5265
5266 for (;;)
5267 {
5268 DDSURFACEDESC *src_desc = (DDSURFACEDESC *)&src_surface->surface_desc;
5269
5270 TRACE("Copying surface %p to surface %p.\n", src_surface, dst_surface);
5271
5272 if (compare_format(&src_surface->surface_desc.u4.ddpfPixelFormat,
5273 &dst_surface->surface_desc.u4.ddpfPixelFormat))
5274 {
5275 struct ddraw_palette *dst_pal, *src_pal;
5276
5277 /* Get the palettes */
5278 dst_pal = dst_surface->palette;
5279 src_pal = src_surface->palette;
5280
5281 if (src_pal)
5282 {
5283 PALETTEENTRY palent[256];
5284
5285 if (!dst_pal)
5286 {
5289 }
5290 IDirectDrawPalette_GetEntries(&src_pal->IDirectDrawPalette_iface, 0, 0, 256, palent);
5291 IDirectDrawPalette_SetEntries(&dst_pal->IDirectDrawPalette_iface, 0, 0, 256, palent);
5292 }
5293
5294 if (src_desc->dwFlags & DDSD_CKSRCBLT)
5295 {
5296 IDirectDrawSurface7_SetColorKey(&dst_surface->IDirectDrawSurface7_iface,
5297 DDCKEY_SRCBLT, &src_desc->ddckCKSrcBlt);
5298 }
5299 }
5300 else
5301 {
5302 if (src_desc->dwFlags & DDSD_CKSRCBLT)
5303 return E_FAIL;
5304 }
5305
5306 /* Suppress the ALLOCONLOAD flag */
5307 dst_surface->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
5308
5309 SetRect(&src_rect, 0, 0, src_surface->surface_desc.dwWidth, src_surface->surface_desc.dwHeight);
5310 SetRect(&dst_rect, 0, 0, dst_surface->surface_desc.dwWidth, dst_surface->surface_desc.dwHeight);
5311
5312 hr = wined3d_texture_blt(dst_surface->wined3d_texture, dst_surface->sub_resource_idx, &dst_rect,
5313 src_surface->wined3d_texture, src_surface->sub_resource_idx, &src_rect,
5315 if (FAILED(hr))
5316 {
5317 ERR("Failed to blit surface, hr %#x.\n", hr);
5319 return hr;
5320 }
5321
5322 if (src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP)
5323 src_surface = get_sub_mimaplevel(src_surface);
5324 else
5325 src_surface = NULL;
5326
5327 if (dst_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP)
5328 dst_surface = get_sub_mimaplevel(dst_surface);
5329 else
5330 dst_surface = NULL;
5331
5332 if (src_surface && !dst_surface)
5333 return DDERR_NOTFOUND;
5334
5335 if (!src_surface || !dst_surface)
5336 break;
5337 }
5338
5340
5341 return hr;
5342}
#define E_FAIL
Definition: ddrawi.h:102
static BOOL compare_format(DDPIXELFORMAT *format1, DDPIXELFORMAT *format2)
Definition: surface.c:5192
static struct ddraw_surface * get_sub_mimaplevel(struct ddraw_surface *surface)
Definition: surface.c:5177
struct ddraw_surface * unsafe_impl_from_IDirect3DTexture2(IDirect3DTexture2 *iface)
Definition: surface.c:5721
HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: texture.c:3262
#define FAILED(hr)
Definition: intsafe.h:51
#define DDSCAPS_MIPMAP
Definition: ddraw.h:272
#define DDERR_NOTFOUND
Definition: ddraw.h:97
#define DDERR_NOPALETTEATTACHED
Definition: ddraw.h:146
#define DDSD_CKSRCBLT
Definition: ddraw.h:220
#define DDCKEY_SRCBLT
Definition: ddraw.h:478
HRESULT hr
Definition: shlfolder.c:183
DWORD dwCaps
Definition: ddraw.h:732
DWORD dwWidth
Definition: ddraw.h:1155
DWORD dwHeight
Definition: ddraw.h:1154
DDSCAPS2 ddsCaps
Definition: ddraw.h:1188
DDPIXELFORMAT ddpfPixelFormat
Definition: ddraw.h:1185
IDirectDrawPalette IDirectDrawPalette_iface
DDSURFACEDESC2 surface_desc
unsigned int sub_resource_idx
struct ddraw_palette * palette
struct wined3d_texture * wined3d_texture
@ WINED3D_TEXF_LINEAR
Definition: wined3d.h:687
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by d3d_texture1_Load().

◆ d3d_texture2_PaletteChanged()

static HRESULT WINAPI d3d_texture2_PaletteChanged ( IDirect3DTexture2 *  iface,
DWORD  start,
DWORD  count 
)
static

Definition at line 5080 of file surface.c.

5081{
5082 FIXME("iface %p, start %u, count %u stub!\n", iface, start, count);
5083
5084 return D3D_OK;
5085}
#define FIXME(fmt,...)
Definition: precomp.h:53

Referenced by d3d_texture1_PaletteChanged().

◆ d3d_texture2_QueryInterface()

static HRESULT WINAPI d3d_texture2_QueryInterface ( IDirect3DTexture2 *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 297 of file surface.c.

298{
299 struct ddraw_surface *surface = impl_from_IDirect3DTexture2(iface);
300
301 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
302
304}

◆ d3d_texture2_Release()

static ULONG WINAPI d3d_texture2_Release ( IDirect3DTexture2 *  iface)
static

Definition at line 691 of file surface.c.

692{
693 struct ddraw_surface *surface = impl_from_IDirect3DTexture2(iface);
694
695 TRACE("iface %p.\n", iface);
696
697 return IUnknown_Release(surface->texture_outer);
698}

◆ ddraw_gamma_control_AddRef()

static ULONG WINAPI ddraw_gamma_control_AddRef ( IDirectDrawGammaControl *  iface)
static

Definition at line 416 of file surface.c.

417{
419 ULONG refcount = InterlockedIncrement(&This->gamma_count);
420
421 TRACE("iface %p increasing refcount to %u.\n", iface, refcount);
422
423 if (refcount == 1)
424 {
426 }
427
428 return refcount;
429}
#define InterlockedIncrement
Definition: armddk.h:53
static struct ddraw_surface * impl_from_IDirectDrawGammaControl(IDirectDrawGammaControl *iface)
Definition: surface.c:34
static void ddraw_surface_add_iface(struct ddraw_surface *surface)
Definition: surface.c:315
uint32_t ULONG
Definition: typedefs.h:59

◆ ddraw_gamma_control_GetGammaRamp()

static HRESULT WINAPI ddraw_gamma_control_GetGammaRamp ( IDirectDrawGammaControl *  iface,
DWORD  flags,
DDGAMMARAMP gamma_ramp 
)
static

Definition at line 4996 of file surface.c.

4998{
4999 struct ddraw_surface *surface = impl_from_IDirectDrawGammaControl(iface);
5000
5001 TRACE("iface %p, flags %#x, gamma_ramp %p.\n", iface, flags, gamma_ramp);
5002
5003 if (!gamma_ramp)
5004 {
5005 WARN("Invalid gamma_ramp passed.\n");
5006 return DDERR_INVALIDPARAMS;
5007 }
5008
5011 {
5012 /* Note: DDGAMMARAMP is compatible with struct wined3d_gamma_ramp. */
5013 wined3d_device_get_gamma_ramp(surface->ddraw->wined3d_device, 0, (struct wined3d_gamma_ramp *)gamma_ramp);
5014 }
5015 else
5016 {
5017 ERR("Not implemented for non-primary surfaces.\n");
5018 }
5020
5021 return DD_OK;
5022}
void CDECL wined3d_device_get_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_gamma_ramp *ramp)
Definition: device.c:5069
GLbitfield flags
Definition: glext.h:7161
#define DDSCAPS_PRIMARYSURFACE
Definition: ddraw.h:258
#define DD_OK
Definition: ddraw.h:186
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
struct ddraw * ddraw

◆ ddraw_gamma_control_QueryInterface()

static HRESULT WINAPI ddraw_gamma_control_QueryInterface ( IDirectDrawGammaControl *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 287 of file surface.c.

289{
290 struct ddraw_surface *surface = impl_from_IDirectDrawGammaControl(iface);
291
292 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
293
295}

◆ ddraw_gamma_control_Release()

static ULONG WINAPI ddraw_gamma_control_Release ( IDirectDrawGammaControl *  iface)
static

Definition at line 676 of file surface.c.

677{
679 ULONG refcount = InterlockedDecrement(&This->gamma_count);
680
681 TRACE("iface %p decreasing refcount to %u.\n", iface, refcount);
682
683 if (refcount == 0)
684 {
686 }
687
688 return refcount;
689}
#define InterlockedDecrement
Definition: armddk.h:52
static ULONG ddraw_surface_release_iface(struct ddraw_surface *This)
Definition: surface.c:533

◆ ddraw_gamma_control_SetGammaRamp()

static HRESULT WINAPI ddraw_gamma_control_SetGammaRamp ( IDirectDrawGammaControl *  iface,
DWORD  flags,
DDGAMMARAMP gamma_ramp 
)
static

Definition at line 5038 of file surface.c.

5040{
5041 struct ddraw_surface *surface = impl_from_IDirectDrawGammaControl(iface);
5042
5043 TRACE("iface %p, flags %#x, gamma_ramp %p.\n", iface, flags, gamma_ramp);
5044
5045 if (!gamma_ramp)
5046 {
5047 WARN("Invalid gamma_ramp passed.\n");
5048 return DDERR_INVALIDPARAMS;
5049 }
5050
5053 {
5054 /* Note: DDGAMMARAMP is compatible with struct wined3d_gamma_ramp. */
5055 wined3d_device_set_gamma_ramp(surface->ddraw->wined3d_device,
5056 0, flags, (struct wined3d_gamma_ramp *)gamma_ramp);
5057 }
5058 else
5059 {
5060 ERR("Not implemented for non-primary surfaces.\n");
5061 }
5063
5064 return DD_OK;
5065}
void CDECL wined3d_device_set_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, DWORD flags, const struct wined3d_gamma_ramp *ramp)
Definition: device.c:5057

◆ ddraw_reset_enum_callback()

static HRESULT CDECL ddraw_reset_enum_callback ( struct wined3d_resource resource)
static

Definition at line 5786 of file surface.c.

5787{
5788 return DD_OK;
5789}

Referenced by ddraw_surface_create().

◆ ddraw_surface1_AddAttachedSurface()

static HRESULT WINAPI ddraw_surface1_AddAttachedSurface ( IDirectDrawSurface *  iface,
IDirectDrawSurface *  attachment 
)
static

Definition at line 1989 of file surface.c.

1990{
1991 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
1993 HRESULT hr;
1994
1995 TRACE("iface %p, attachment %p.\n", iface, attachment);
1996
1998 attachment_impl ? &attachment_impl->IDirectDrawSurface4_iface : NULL)))
1999 return hr;
2000
2001 attachment_impl->attached_iface = (IUnknown *)attachment;
2002 IUnknown_AddRef(attachment_impl->attached_iface);
2004 return hr;
2005}
static struct ddraw_surface * impl_from_IDirectDrawSurface(IDirectDrawSurface *iface)
static ULONG WINAPI ddraw_surface4_Release(IDirectDrawSurface4 *iface)
Definition: surface.c:616
static HRESULT WINAPI ddraw_surface4_AddAttachedSurface(IDirectDrawSurface4 *iface, IDirectDrawSurface4 *attachment)
Definition: surface.c:1914
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *iface)
Definition: surface.c:5705
GLenum attachment
Definition: glext.h:6295
IUnknown * attached_iface
IDirectDrawSurface4 IDirectDrawSurface4_iface

◆ ddraw_surface1_AddOverlayDirtyRect()

static HRESULT WINAPI ddraw_surface1_AddOverlayDirtyRect ( IDirectDrawSurface *  iface,
RECT rect 
)
static

Definition at line 2186 of file surface.c.

2187{
2188 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
2189
2190 TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(rect));
2191
2193}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
static HRESULT WINAPI ddraw_surface7_AddOverlayDirtyRect(IDirectDrawSurface7 *iface, RECT *Rect)
Definition: surface.c:2152
& rect
Definition: startmenu.cpp:1413

◆ ddraw_surface1_AddRef()

static ULONG WINAPI ddraw_surface1_AddRef ( IDirectDrawSurface *  iface)
static

Definition at line 401 of file surface.c.

402{
404 ULONG refcount = InterlockedIncrement(&This->ref1);
405
406 TRACE("iface %p increasing refcount to %u.\n", iface, refcount);
407
408 if (refcount == 1)
409 {
411 }
412
413 return refcount;
414}

Referenced by ddraw_surface1_GetAttachedSurface(), and EnumCallback().

◆ ddraw_surface1_Blt()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Blt ( IDirectDrawSurface *  iface,
RECT dst_rect,
IDirectDrawSurface *  src_surface,
RECT src_rect,
DWORD  flags,
DDBLTFX fx 
)
static

Definition at line 1794 of file surface.c.

1796{
1798 struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface(src_surface);
1799
1800 TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n",
1801 iface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx);
1802
1803 return ddraw_surface7_Blt(&dst->IDirectDrawSurface7_iface, dst_rect,
1804 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags, fx);
1805}
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Blt(IDirectDrawSurface7 *iface, RECT *dst_rect, IDirectDrawSurface7 *src_surface, RECT *src_rect, DWORD flags, DDBLTFX *fx)
Definition: surface.c:1574
GLenum GLenum dst
Definition: glext.h:6340
GLfixed fx
Definition: tritemp.h:484

◆ ddraw_surface1_BltBatch()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_BltBatch ( IDirectDrawSurface *  iface,
DDBLTBATCH batch,
DWORD  count,
DWORD  flags 
)
static

Definition at line 2807 of file surface.c.

2808{
2809 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
2810
2811 TRACE("iface %p, batch %p, count %u, flags %#x.\n", iface, batch, count, flags);
2812
2814}
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_BltBatch(IDirectDrawSurface7 *iface, DDBLTBATCH *Batch, DWORD Count, DWORD Flags)
Definition: surface.c:2772

◆ ddraw_surface1_BltFast()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_BltFast ( IDirectDrawSurface *  iface,
DWORD  dst_x,
DWORD  dst_y,
IDirectDrawSurface *  src_surface,
RECT src_rect,
DWORD  flags 
)
static

Definition at line 4348 of file surface.c.

4350{
4351 struct ddraw_surface *dst_impl = impl_from_IDirectDrawSurface(iface);
4352 struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface(src_surface);
4353
4354 TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n",
4355 iface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), flags);
4356
4357 return ddraw_surface7_BltFast(&dst_impl->IDirectDrawSurface7_iface, dst_x, dst_y,
4358 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags);
4359}
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_BltFast(IDirectDrawSurface7 *iface, DWORD dst_x, DWORD dst_y, IDirectDrawSurface7 *src_surface, RECT *src_rect, DWORD trans)
Definition: surface.c:4244

◆ ddraw_surface1_DeleteAttachedSurface()

static HRESULT WINAPI ddraw_surface1_DeleteAttachedSurface ( IDirectDrawSurface *  iface,
DWORD  flags,
IDirectDrawSurface *  attachment 
)
static

Definition at line 2129 of file surface.c.

2131{
2132 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
2134
2135 TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment);
2136
2137 return ddraw_surface_delete_attached_surface(surface, attachment_impl, (IUnknown *)attachment);
2138}
static HRESULT ddraw_surface_delete_attached_surface(struct ddraw_surface *surface, struct ddraw_surface *attachment, IUnknown *detach_iface)
Definition: surface.c:2022

◆ ddraw_surface1_EnumAttachedSurfaces()

static HRESULT WINAPI ddraw_surface1_EnumAttachedSurfaces ( IDirectDrawSurface *  iface,
void context,
LPDDENUMSURFACESCALLBACK  callback 
)
static

Definition at line 2961 of file surface.c.

2963{
2964 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
2965 struct callback_info info;
2966
2967 TRACE("iface %p, context %p, callback %p.\n", iface, context, callback);
2968
2969 info.callback = callback;
2970 info.context = context;
2971
2973 &info, EnumCallback);
2974}
static HRESULT CALLBACK EnumCallback(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *surface_desc, void *context)
Definition: surface.c:2903
static HRESULT WINAPI ddraw_surface7_EnumAttachedSurfaces(IDirectDrawSurface7 *iface, void *context, LPDDENUMSURFACESCALLBACK7 cb)
Definition: surface.c:2830
static IPrintDialogCallback callback
Definition: printdlg.c:326
void * context
Definition: main.c:47
Definition: http.c:7252

◆ ddraw_surface1_EnumOverlayZOrders()

static HRESULT WINAPI ddraw_surface1_EnumOverlayZOrders ( IDirectDrawSurface *  iface,
DWORD  flags,
void context,
LPDDENUMSURFACESCALLBACK  callback 
)
static

Definition at line 3043 of file surface.c.

3045{
3046 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3047 struct callback_info info;
3048
3049 TRACE("iface %p, flags %#x, context %p, callback %p.\n", iface, flags, context, callback);
3050
3051 info.callback = callback;
3052 info.context = context;
3053
3056}
static HRESULT WINAPI ddraw_surface7_EnumOverlayZOrders(IDirectDrawSurface7 *iface, DWORD Flags, void *context, LPDDENUMSURFACESCALLBACK7 cb)
Definition: surface.c:2990

◆ ddraw_surface1_Flip()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Flip ( IDirectDrawSurface *  iface,
IDirectDrawSurface *  src,
DWORD  flags 
)
static

Definition at line 1395 of file surface.c.

1397{
1398 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
1400
1401 TRACE("iface %p, src %p, flags %#x.\n", iface, src, flags);
1402
1404 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, flags);
1405}
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7 *iface, IDirectDrawSurface7 *src, DWORD flags)
Definition: surface.c:1227
GLenum src
Definition: glext.h:6340

◆ ddraw_surface1_GetAttachedSurface()

static HRESULT WINAPI ddraw_surface1_GetAttachedSurface ( IDirectDrawSurface *  iface,
DDSCAPS caps,
IDirectDrawSurface **  attachment 
)
static

Definition at line 909 of file surface.c.

911{
912 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
913 struct ddraw_surface *attachment_impl;
914 IDirectDrawSurface7 *attachment7;
915 DDSCAPS2 caps2;
916 HRESULT hr;
917
918 TRACE("iface %p, caps %p, attachment %p.\n", iface, caps, attachment);
919
920 caps2.dwCaps = caps->dwCaps;
921 caps2.dwCaps2 = 0;
922 caps2.dwCaps3 = 0;
923 caps2.u1.dwCaps4 = 0;
924
926 &caps2, &attachment7);
927 if (FAILED(hr))
928 {
929 *attachment = NULL;
930 return hr;
931 }
932 attachment_impl = impl_from_IDirectDrawSurface7(attachment7);
933 *attachment = &attachment_impl->IDirectDrawSurface_iface;
935 ddraw_surface7_Release(attachment7);
936
937 return hr;
938}
static struct ddraw_surface * impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface)
static HRESULT WINAPI ddraw_surface7_GetAttachedSurface(IDirectDrawSurface7 *iface, DDSCAPS2 *Caps, IDirectDrawSurface7 **Surface)
Definition: surface.c:736
static ULONG WINAPI ddraw_surface7_Release(IDirectDrawSurface7 *iface)
Definition: surface.c:601
static ULONG WINAPI ddraw_surface1_AddRef(IDirectDrawSurface *iface)
Definition: surface.c:401
DWORD IDirectDrawSurface7
Definition: vmrender.idl:20
DWORD dwCaps4
Definition: ddraw.h:737
DWORD dwCaps3
Definition: ddraw.h:734
DWORD dwCaps2
Definition: ddraw.h:733
DWORD dwCaps
Definition: ddraw.h:727
IDirectDrawSurface IDirectDrawSurface_iface

◆ ddraw_surface1_GetBltStatus()

static HRESULT WINAPI ddraw_surface1_GetBltStatus ( IDirectDrawSurface *  iface,
DWORD  flags 
)
static

Definition at line 3109 of file surface.c.

3110{
3111 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3112
3113 TRACE("iface %p, flags %#x.\n", iface, flags);
3114
3116}
static HRESULT WINAPI ddraw_surface7_GetBltStatus(IDirectDrawSurface7 *iface, DWORD Flags)
Definition: surface.c:3067

◆ ddraw_surface1_GetCaps()

static HRESULT WINAPI ddraw_surface1_GetCaps ( IDirectDrawSurface *  iface,
DDSCAPS caps 
)
static

Definition at line 2436 of file surface.c.

2437{
2438 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
2439 DDSCAPS2 caps2;
2440 HRESULT hr;
2441
2442 TRACE("iface %p, caps %p.\n", iface, caps);
2443
2445 if (FAILED(hr)) return hr;
2446
2447 caps->dwCaps = caps2.dwCaps;
2448 return hr;
2449}
static HRESULT WINAPI ddraw_surface7_GetCaps(IDirectDrawSurface7 *iface, DDSCAPS2 *Caps)
Definition: surface.c:2383

◆ ddraw_surface1_GetClipper()

static HRESULT WINAPI ddraw_surface1_GetClipper ( IDirectDrawSurface *  iface,
IDirectDrawClipper **  clipper 
)
static

Definition at line 4426 of file surface.c.

4427{
4428 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
4429
4430 TRACE("iface %p, clipper %p.\n", iface, clipper);
4431
4433}
static HRESULT WINAPI ddraw_surface7_GetClipper(IDirectDrawSurface7 *iface, IDirectDrawClipper **Clipper)
Definition: surface.c:4376
struct ddraw_clipper * clipper

◆ ddraw_surface1_GetColorKey()

static HRESULT WINAPI ddraw_surface1_GetColorKey ( IDirectDrawSurface *  iface,
DWORD  flags,
DDCOLORKEY color_key 
)
static

Definition at line 3218 of file surface.c.

3219{
3220 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3221
3222 TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
3223
3225}
static HRESULT WINAPI ddraw_surface7_GetColorKey(IDirectDrawSurface7 *iface, DWORD Flags, DDCOLORKEY *CKey)
Definition: surface.c:3132

◆ ddraw_surface1_GetDC()

static HRESULT WINAPI ddraw_surface1_GetDC ( IDirectDrawSurface *  iface,
HDC dc 
)
static

Definition at line 2287 of file surface.c.

2288{
2289 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
2290
2291 TRACE("iface %p, dc %p.\n", iface, dc);
2292
2294}
static HRESULT WINAPI ddraw_surface7_GetDC(IDirectDrawSurface7 *iface, HDC *dc)
Definition: surface.c:2208
static const WCHAR dc[]

◆ ddraw_surface1_GetFlipStatus()

static HRESULT WINAPI ddraw_surface1_GetFlipStatus ( IDirectDrawSurface *  iface,
DWORD  flags 
)
static

Definition at line 3280 of file surface.c.

3281{
3282 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3283
3284 TRACE("iface %p, flags %#x.\n", iface, flags);
3285
3287}
static HRESULT WINAPI ddraw_surface7_GetFlipStatus(IDirectDrawSurface7 *iface, DWORD Flags)
Definition: surface.c:3236

◆ ddraw_surface1_GetOverlayPosition()

static HRESULT WINAPI ddraw_surface1_GetOverlayPosition ( IDirectDrawSurface *  iface,
LONG x,
LONG y 
)
static

Definition at line 3343 of file surface.c.

3344{
3345 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3346
3347 TRACE("iface %p, x %p, y %p.\n", iface, x, y);
3348
3350}
static HRESULT WINAPI ddraw_surface7_GetOverlayPosition(IDirectDrawSurface7 *iface, LONG *x, LONG *y)
Definition: surface.c:3301
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ ddraw_surface1_GetPalette()

static HRESULT WINAPI ddraw_surface1_GetPalette ( IDirectDrawSurface *  iface,
IDirectDrawPalette **  palette 
)
static

Definition at line 4766 of file surface.c.

4767{
4768 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
4769
4770 TRACE("iface %p, palette %p.\n", iface, palette);
4771
4773}
static HRESULT WINAPI ddraw_surface7_GetPalette(IDirectDrawSurface7 *iface, IDirectDrawPalette **palette)
Definition: surface.c:4707
static HPALETTE palette
Definition: clipboard.c:1345

◆ ddraw_surface1_GetPixelFormat()

static HRESULT WINAPI ddraw_surface1_GetPixelFormat ( IDirectDrawSurface *  iface,
DDPIXELFORMAT pixel_format 
)
static

Definition at line 3410 of file surface.c.

3411{
3412 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3413
3414 TRACE("iface %p, pixel_format %p.\n", iface, pixel_format);
3415
3417}
static HRESULT WINAPI ddraw_surface7_GetPixelFormat(IDirectDrawSurface7 *iface, DDPIXELFORMAT *PixelFormat)
Definition: surface.c:3366

◆ ddraw_surface1_GetSurfaceDesc()

static HRESULT WINAPI ddraw_surface1_GetSurfaceDesc ( IDirectDrawSurface *  iface,
DDSURFACEDESC DDSD 
)
static

Definition at line 3502 of file surface.c.

3503{
3504 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3505
3506 TRACE("iface %p, surface_desc %p.\n", iface, DDSD);
3507
3509}
static HRESULT WINAPI ddraw_surface3_GetSurfaceDesc(IDirectDrawSurface3 *iface, DDSURFACEDESC *surface_desc)
Definition: surface.c:3466
IDirectDrawSurface3 IDirectDrawSurface3_iface

◆ ddraw_surface1_Initialize()

static HRESULT WINAPI ddraw_surface1_Initialize ( IDirectDrawSurface *  iface,
IDirectDraw *  ddraw,
DDSURFACEDESC surface_desc 
)
static

Definition at line 3569 of file surface.c.

3571{
3572 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3573 DDSURFACEDESC2 surface_desc2;
3574
3575 TRACE("iface %p, ddraw %p, surface_desc %p.\n", iface, ddraw, surface_desc);
3576
3577 if (surface_desc) DDSD_to_DDSD2(surface_desc, &surface_desc2);
3579 ddraw, surface_desc ? &surface_desc2 : NULL);
3580}
void DDSD_to_DDSD2(const DDSURFACEDESC *in, DDSURFACEDESC2 *out) DECLSPEC_HIDDEN
Definition: utils.c:1218
static HRESULT WINAPI ddraw_surface7_Initialize(IDirectDrawSurface7 *iface, IDirectDraw *ddraw, DDSURFACEDESC2 *surface_desc)
Definition: surface.c:3524

◆ ddraw_surface1_IsLost()

static HRESULT WINAPI ddraw_surface1_IsLost ( IDirectDrawSurface *  iface)
static

Definition at line 3651 of file surface.c.

3652{
3653 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3654
3655 TRACE("iface %p.\n", iface);
3656
3658}
static HRESULT WINAPI ddraw_surface7_IsLost(IDirectDrawSurface7 *iface)
Definition: surface.c:3612

◆ ddraw_surface1_Lock()

static HRESULT WINAPI ddraw_surface1_Lock ( IDirectDrawSurface *  iface,
RECT rect,
DDSURFACEDESC surface_desc,
DWORD  flags,
HANDLE  h 
)
static

Definition at line 1138 of file surface.c.

1140{
1141 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
1142 unsigned int surface_desc_size;
1143 DDSURFACEDESC2 surface_desc2;
1144 HRESULT hr;
1145
1146 TRACE("iface %p, rect %s, surface_desc %p, flags %#x, h %p.\n",
1148
1149 if (!surface_validate_lock_desc(surface, surface_desc, &surface_desc_size))
1150 return DDERR_INVALIDPARAMS;
1151
1152 surface_desc2.dwSize = surface_desc->dwSize;
1153 surface_desc2.dwFlags = 0;
1154 hr = surface_lock(surface, rect, &surface_desc2, surface_desc_size, flags, h);
1155 DDSD2_to_DDSD(&surface_desc2, surface_desc);
1156 surface_desc->dwSize = surface_desc2.dwSize;
1157 return hr;
1158}
void DDSD2_to_DDSD(const DDSURFACEDESC2 *in, DDSURFACEDESC *out) DECLSPEC_HIDDEN
Definition: utils.c:1262
static HRESULT surface_lock(struct ddraw_surface *surface, RECT *rect, DDSURFACEDESC2 *surface_desc, unsigned int surface_desc_size, DWORD flags, HANDLE h)
Definition: surface.c:956
static BOOL surface_validate_lock_desc(struct ddraw_surface *surface, const DDSURFACEDESC *desc, unsigned int *size)
Definition: surface.c:1037
DWORD dwFlags
Definition: ddraw.h:1153
DWORD dwSize
Definition: ddraw.h:1152

◆ ddraw_surface1_QueryInterface()

static HRESULT WINAPI ddraw_surface1_QueryInterface ( IDirectDrawSurface *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 278 of file surface.c.

279{
280 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
281
282 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
283
285}

◆ ddraw_surface1_Release()

static ULONG WINAPI ddraw_surface1_Release ( IDirectDrawSurface *  iface)
static

Definition at line 661 of file surface.c.

662{
664 ULONG refcount = InterlockedDecrement(&This->ref1);
665
666 TRACE("iface %p decreasing refcount to %u.\n", iface, refcount);
667
668 if (refcount == 0)
669 {
671 }
672
673 return refcount;
674}

◆ ddraw_surface1_ReleaseDC()

static HRESULT WINAPI ddraw_surface1_ReleaseDC ( IDirectDrawSurface *  iface,
HDC  dc 
)
static

Definition at line 2361 of file surface.c.

2362{
2363 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
2364
2365 TRACE("iface %p, dc %p.\n", iface, dc);
2366
2368}
static HRESULT WINAPI ddraw_surface7_ReleaseDC(IDirectDrawSurface7 *iface, HDC hdc)
Definition: surface.c:2308

◆ ddraw_surface1_Restore()

static HRESULT WINAPI ddraw_surface1_Restore ( IDirectDrawSurface *  iface)
static

Definition at line 3743 of file surface.c.

3744{
3745 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3746
3747 TRACE("iface %p.\n", iface);
3748
3750}
static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface)
Definition: surface.c:3670

◆ ddraw_surface1_SetClipper()

static HRESULT WINAPI ddraw_surface1_SetClipper ( IDirectDrawSurface *  iface,
IDirectDrawClipper *  clipper 
)
static

Definition at line 4522 of file surface.c.

4523{
4524 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
4525
4526 TRACE("iface %p, clipper %p.\n", iface, clipper);
4527
4529}
static HRESULT WINAPI ddraw_surface7_SetClipper(IDirectDrawSurface7 *iface, IDirectDrawClipper *iclipper)
Definition: surface.c:4447

◆ ddraw_surface1_SetColorKey()

static HRESULT WINAPI ddraw_surface1_SetColorKey ( IDirectDrawSurface *  iface,
DWORD  flags,
DDCOLORKEY color_key 
)
static

Definition at line 4896 of file surface.c.

4897{
4898 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
4899
4900 TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
4901
4903}
static HRESULT ddraw_surface_set_color_key(struct ddraw_surface *surface, DWORD flags, DDCOLORKEY *color_key)
Definition: surface.c:4775

◆ ddraw_surface1_SetOverlayPosition()

static HRESULT WINAPI ddraw_surface1_SetOverlayPosition ( IDirectDrawSurface *  iface,
LONG  x,
LONG  y 
)
static

Definition at line 3806 of file surface.c.

3807{
3808 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3809
3810 TRACE("iface %p, x %d, y %d.\n", iface, x, y);
3811
3813}
static HRESULT WINAPI ddraw_surface7_SetOverlayPosition(IDirectDrawSurface7 *iface, LONG x, LONG y)
Definition: surface.c:3764

◆ ddraw_surface1_SetPalette()

static HRESULT WINAPI ddraw_surface1_SetPalette ( IDirectDrawSurface *  iface,
IDirectDrawPalette *  palette 
)
static

Definition at line 4967 of file surface.c.

4968{
4969 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
4970
4971 TRACE("iface %p, palette %p.\n", iface, palette);
4972
4973 if (IDirectDrawSurface_IsLost(iface) == DDERR_SURFACELOST)
4974 {
4975 WARN("Surface lost, returning DDERR_SURFACELOST.\n");
4976 return DDERR_SURFACELOST;
4977 }
4978
4979 return ddraw_surface_set_palette(surface, palette);
4980}
static HRESULT ddraw_surface_set_palette(struct ddraw_surface *surface, IDirectDrawPalette *palette)
Definition: surface.c:449
#define DDERR_SURFACELOST
Definition: ddraw.h:122

◆ ddraw_surface1_Unlock()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Unlock ( IDirectDrawSurface *  iface,
void data 
)
static

Definition at line 1217 of file surface.c.

1218{
1219 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
1220
1221 TRACE("iface %p, data %p.\n", iface, data);
1222
1223 /* data might not be the LPRECT of later versions, so drop it. */
1225}
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Unlock(IDirectDrawSurface7 *iface, RECT *pRect)
Definition: surface.c:1172
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ ddraw_surface1_UpdateOverlay()

static HRESULT WINAPI ddraw_surface1_UpdateOverlay ( IDirectDrawSurface *  iface,
RECT src_rect,
IDirectDrawSurface *  dst_surface,
RECT dst_rect,
DWORD  flags,
DDOVERLAYFX fx 
)
static

Definition at line 3904 of file surface.c.

3906{
3907 struct ddraw_surface *src_impl = impl_from_IDirectDrawSurface(iface);
3908 struct ddraw_surface *dst_impl = unsafe_impl_from_IDirectDrawSurface(dst_surface);
3909
3910 TRACE("iface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n",
3911 iface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx);
3912
3913 return ddraw_surface7_UpdateOverlay(&src_impl->IDirectDrawSurface7_iface, src_rect,
3914 dst_impl ? &dst_impl->IDirectDrawSurface7_iface : NULL, dst_rect, flags, fx);
3915}
static HRESULT WINAPI ddraw_surface7_UpdateOverlay(IDirectDrawSurface7 *iface, RECT *src_rect, IDirectDrawSurface7 *dst_surface, RECT *dst_rect, DWORD flags, DDOVERLAYFX *fx)
Definition: surface.c:3830

◆ ddraw_surface1_UpdateOverlayDisplay()

static HRESULT WINAPI ddraw_surface1_UpdateOverlayDisplay ( IDirectDrawSurface *  iface,
DWORD  flags 
)
static

Definition at line 3962 of file surface.c.

3963{
3964 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
3965
3966 TRACE("iface %p, flags %#x.\n", iface, flags);
3967
3969}
static HRESULT WINAPI ddraw_surface7_UpdateOverlayDisplay(IDirectDrawSurface7 *iface, DWORD Flags)
Definition: surface.c:3928

◆ ddraw_surface1_UpdateOverlayZOrder()

static HRESULT WINAPI ddraw_surface1_UpdateOverlayZOrder ( IDirectDrawSurface *  iface,
DWORD  flags,
IDirectDrawSurface *  reference 
)
static

Definition at line 4039 of file surface.c.

4041{
4042 struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
4044
4045 TRACE("iface %p, flags %#x, reference %p.\n", iface, flags, reference);
4046
4048 reference_impl ? &reference_impl->IDirectDrawSurface7_iface : NULL);
4049}
static HRESULT WINAPI ddraw_surface7_UpdateOverlayZOrder(IDirectDrawSurface7 *iface, DWORD flags, IDirectDrawSurface7 *reference)
Definition: surface.c:3984
GLint reference
Definition: glext.h:11729

◆ ddraw_surface2_AddAttachedSurface()

static HRESULT WINAPI ddraw_surface2_AddAttachedSurface ( IDirectDrawSurface2 *  iface,
IDirectDrawSurface2 *  attachment 
)
static

Definition at line 1971 of file surface.c.

1972{
1973 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
1975 HRESULT hr;
1976
1977 TRACE("iface %p, attachment %p.\n", iface, attachment);
1978
1980 attachment_impl ? &attachment_impl->IDirectDrawSurface4_iface : NULL)))
1981 return hr;
1982
1983 attachment_impl->attached_iface = (IUnknown *)attachment;
1984 IUnknown_AddRef(attachment_impl->attached_iface);
1986 return hr;
1987}
static struct ddraw_surface * impl_from_IDirectDrawSurface2(IDirectDrawSurface2 *iface)
static struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface2(IDirectDrawSurface2 *iface)
Definition: surface.c:5689

◆ ddraw_surface2_AddOverlayDirtyRect()

static HRESULT WINAPI ddraw_surface2_AddOverlayDirtyRect ( IDirectDrawSurface2 *  iface,
RECT rect 
)
static

Definition at line 2177 of file surface.c.

2178{
2179 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
2180
2181 TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(rect));
2182
2184}

◆ ddraw_surface2_AddRef()

static ULONG WINAPI ddraw_surface2_AddRef ( IDirectDrawSurface2 *  iface)
static

Definition at line 386 of file surface.c.

387{
389 ULONG refcount = InterlockedIncrement(&This->ref2);
390
391 TRACE("iface %p increasing refcount to %u.\n", iface, refcount);
392
393 if (refcount == 1)
394 {
396 }
397
398 return refcount;
399}

Referenced by ddraw_surface2_GetAttachedSurface().

◆ ddraw_surface2_Blt()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_Blt ( IDirectDrawSurface2 *  iface,
RECT dst_rect,
IDirectDrawSurface2 *  src_surface,
RECT src_rect,
DWORD  flags,
DDBLTFX fx 
)
static

Definition at line 1781 of file surface.c.

1783{
1785 struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface2(src_surface);
1786
1787 TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n",
1788 iface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx);
1789
1790 return ddraw_surface7_Blt(&dst->IDirectDrawSurface7_iface, dst_rect,
1791 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags, fx);
1792}

◆ ddraw_surface2_BltBatch()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_BltBatch ( IDirectDrawSurface2 *  iface,
DDBLTBATCH batch,
DWORD  count,
DWORD  flags 
)
static

Definition at line 2798 of file surface.c.

2799{
2800 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
2801
2802 TRACE("iface %p, batch %p, count %u, flags %#x.\n", iface, batch, count, flags);
2803
2805}

◆ ddraw_surface2_BltFast()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_BltFast ( IDirectDrawSurface2 *  iface,
DWORD  dst_x,
DWORD  dst_y,
IDirectDrawSurface2 *  src_surface,
RECT src_rect,
DWORD  flags 
)
static

Definition at line 4335 of file surface.c.

4337{
4338 struct ddraw_surface *dst_impl = impl_from_IDirectDrawSurface2(iface);
4339 struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface2(src_surface);
4340
4341 TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n",
4342 iface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), flags);
4343
4344 return ddraw_surface7_BltFast(&dst_impl->IDirectDrawSurface7_iface, dst_x, dst_y,
4345 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags);
4346}

◆ ddraw_surface2_DeleteAttachedSurface()

static HRESULT WINAPI ddraw_surface2_DeleteAttachedSurface ( IDirectDrawSurface2 *  iface,
DWORD  flags,
IDirectDrawSurface2 *  attachment 
)
static

Definition at line 2118 of file surface.c.

2120{
2121 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
2123
2124 TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment);
2125
2126 return ddraw_surface_delete_attached_surface(surface, attachment_impl, (IUnknown *)attachment);
2127}

◆ ddraw_surface2_EnumAttachedSurfaces()

static HRESULT WINAPI ddraw_surface2_EnumAttachedSurfaces ( IDirectDrawSurface2 *  iface,
void context,
LPDDENUMSURFACESCALLBACK  callback 
)
static

Definition at line 2946 of file surface.c.

2948{
2949 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
2950 struct callback_info info;
2951
2952 TRACE("iface %p, context %p, callback %p.\n", iface, context, callback);
2953
2954 info.callback = callback;
2955 info.context = context;
2956
2958 &info, EnumCallback);
2959}

◆ ddraw_surface2_EnumOverlayZOrders()

static HRESULT WINAPI ddraw_surface2_EnumOverlayZOrders ( IDirectDrawSurface2 *  iface,
DWORD  flags,
void context,
LPDDENUMSURFACESCALLBACK  callback 
)
static

Definition at line 3028 of file surface.c.

3030{
3031 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3032 struct callback_info info;
3033
3034 TRACE("iface %p, flags %#x, context %p, callback %p.\n", iface, flags, context, callback);
3035
3036 info.callback = callback;
3037 info.context = context;
3038
3041}

◆ ddraw_surface2_Flip()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_Flip ( IDirectDrawSurface2 *  iface,
IDirectDrawSurface2 *  src,
DWORD  flags 
)
static

Definition at line 1383 of file surface.c.

1385{
1386 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
1388
1389 TRACE("iface %p, src %p, flags %#x.\n", iface, src, flags);
1390
1392 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, flags);
1393}

◆ ddraw_surface2_GetAttachedSurface()

static HRESULT WINAPI ddraw_surface2_GetAttachedSurface ( IDirectDrawSurface2 *  iface,
DDSCAPS caps,
IDirectDrawSurface2 **  attachment 
)
static

Definition at line 878 of file surface.c.

880{
881 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
882 struct ddraw_surface *attachment_impl;
883 IDirectDrawSurface7 *attachment7;
884 DDSCAPS2 caps2;
885 HRESULT hr;
886
887 TRACE("iface %p, caps %p, attachment %p.\n", iface, caps, attachment);
888
889 caps2.dwCaps = caps->dwCaps;
890 caps2.dwCaps2 = 0;
891 caps2.dwCaps3 = 0;
892 caps2.u1.dwCaps4 = 0;
893
895 &caps2, &attachment7);
896 if (FAILED(hr))
897 {
898 *attachment = NULL;
899 return hr;
900 }
901 attachment_impl = impl_from_IDirectDrawSurface7(attachment7);
902 *attachment = &attachment_impl->IDirectDrawSurface2_iface;
904 ddraw_surface7_Release(attachment7);
905
906 return hr;
907}
static ULONG WINAPI ddraw_surface2_AddRef(IDirectDrawSurface2 *iface)
Definition: surface.c:386
IDirectDrawSurface2 IDirectDrawSurface2_iface

◆ ddraw_surface2_GetBltStatus()

static HRESULT WINAPI ddraw_surface2_GetBltStatus ( IDirectDrawSurface2 *  iface,
DWORD  flags 
)
static

Definition at line 3100 of file surface.c.

3101{
3102 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3103
3104 TRACE("iface %p, flags %#x.\n", iface, flags);
3105
3107}

◆ ddraw_surface2_GetCaps()

static HRESULT WINAPI ddraw_surface2_GetCaps ( IDirectDrawSurface2 *  iface,
DDSCAPS caps 
)
static

Definition at line 2421 of file surface.c.

2422{
2423 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
2424 DDSCAPS2 caps2;
2425 HRESULT hr;
2426
2427 TRACE("iface %p, caps %p.\n", iface, caps);
2428
2430 if (FAILED(hr)) return hr;
2431
2432 caps->dwCaps = caps2.dwCaps;
2433 return hr;
2434}

◆ ddraw_surface2_GetClipper()

static HRESULT WINAPI ddraw_surface2_GetClipper ( IDirectDrawSurface2 *  iface,
IDirectDrawClipper **  clipper 
)
static

Definition at line 4417 of file surface.c.

4418{
4419 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
4420
4421 TRACE("iface %p, clipper %p.\n", iface, clipper);
4422
4424}

◆ ddraw_surface2_GetColorKey()

static HRESULT WINAPI ddraw_surface2_GetColorKey ( IDirectDrawSurface2 *  iface,
DWORD  flags,
DDCOLORKEY color_key 
)
static

Definition at line 3209 of file surface.c.

3210{
3211 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3212
3213 TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
3214
3216}

◆ ddraw_surface2_GetDC()

static HRESULT WINAPI ddraw_surface2_GetDC ( IDirectDrawSurface2 *  iface,
HDC dc 
)
static

Definition at line 2278 of file surface.c.

2279{
2280 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
2281
2282 TRACE("iface %p, dc %p.\n", iface, dc);
2283
2285}

◆ ddraw_surface2_GetDDInterface()

static HRESULT WINAPI ddraw_surface2_GetDDInterface ( IDirectDrawSurface2 *  iface,
void **  ddraw 
)
static

Definition at line 4116 of file surface.c.

4117{
4118 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
4119
4120 TRACE("iface %p, ddraw %p.\n", iface, ddraw);
4121
4123}
static HRESULT WINAPI ddraw_surface7_GetDDInterface(IDirectDrawSurface7 *iface, void **DD)
Definition: surface.c:4065

◆ ddraw_surface2_GetFlipStatus()

static HRESULT WINAPI ddraw_surface2_GetFlipStatus ( IDirectDrawSurface2 *  iface,
DWORD  flags 
)
static

Definition at line 3271 of file surface.c.

3272{
3273 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3274
3275 TRACE("iface %p, flags %#x.\n", iface, flags);
3276
3278}

◆ ddraw_surface2_GetOverlayPosition()

static HRESULT WINAPI ddraw_surface2_GetOverlayPosition ( IDirectDrawSurface2 *  iface,
LONG x,
LONG y 
)
static

Definition at line 3334 of file surface.c.

3335{
3336 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3337
3338 TRACE("iface %p, x %p, y %p.\n", iface, x, y);
3339
3341}

◆ ddraw_surface2_GetPalette()

static HRESULT WINAPI ddraw_surface2_GetPalette ( IDirectDrawSurface2 *  iface,
IDirectDrawPalette **  palette 
)
static

Definition at line 4757 of file surface.c.

4758{
4759 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
4760
4761 TRACE("iface %p, palette %p.\n", iface, palette);
4762
4764}

◆ ddraw_surface2_GetPixelFormat()

static HRESULT WINAPI ddraw_surface2_GetPixelFormat ( IDirectDrawSurface2 *  iface,
DDPIXELFORMAT pixel_format 
)
static

Definition at line 3401 of file surface.c.

3402{
3403 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3404
3405 TRACE("iface %p, pixel_format %p.\n", iface, pixel_format);
3406
3408}

◆ ddraw_surface2_GetSurfaceDesc()

static HRESULT WINAPI ddraw_surface2_GetSurfaceDesc ( IDirectDrawSurface2 *  iface,
DDSURFACEDESC DDSD 
)
static

Definition at line 3493 of file surface.c.

3494{
3495 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3496
3497 TRACE("iface %p, surface_desc %p.\n", iface, DDSD);
3498
3500}

◆ ddraw_surface2_Initialize()

static HRESULT WINAPI ddraw_surface2_Initialize ( IDirectDrawSurface2 *  iface,
IDirectDraw *  ddraw,
DDSURFACEDESC surface_desc 
)
static

Definition at line 3556 of file surface.c.

3558{
3559 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3560 DDSURFACEDESC2 surface_desc2;
3561
3562 TRACE("iface %p, ddraw %p, surface_desc %p.\n", iface, ddraw, surface_desc);
3563
3564 if (surface_desc) DDSD_to_DDSD2(surface_desc, &surface_desc2);
3566 ddraw, surface_desc ? &surface_desc2 : NULL);
3567}

◆ ddraw_surface2_IsLost()

static HRESULT WINAPI ddraw_surface2_IsLost ( IDirectDrawSurface2 *  iface)
static

Definition at line 3642 of file surface.c.

3643{
3644 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3645
3646 TRACE("iface %p.\n", iface);
3647
3649}

◆ ddraw_surface2_Lock()

static HRESULT WINAPI ddraw_surface2_Lock ( IDirectDrawSurface2 *  iface,
RECT rect,
DDSURFACEDESC surface_desc,
DWORD  flags,
HANDLE  h 
)
static

Definition at line 1116 of file surface.c.

1118{
1119 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
1120 unsigned int surface_desc_size;
1121 DDSURFACEDESC2 surface_desc2;
1122 HRESULT hr;
1123
1124 TRACE("iface %p, rect %s, surface_desc %p, flags %#x, h %p.\n",
1126
1127 if (!surface_validate_lock_desc(surface, surface_desc, &surface_desc_size))
1128 return DDERR_INVALIDPARAMS;
1129
1130 surface_desc2.dwSize = surface_desc->dwSize;
1131 surface_desc2.dwFlags = 0;
1132 hr = surface_lock(surface, rect, &surface_desc2, surface_desc_size, flags, h);
1133 DDSD2_to_DDSD(&surface_desc2, surface_desc);
1134 surface_desc->dwSize = surface_desc2.dwSize;
1135 return hr;
1136}

◆ ddraw_surface2_PageLock()

static HRESULT WINAPI ddraw_surface2_PageLock ( IDirectDrawSurface2 *  iface,
DWORD  flags 
)
static

Definition at line 2705 of file surface.c.

2706{
2707 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
2708
2709 TRACE("iface %p, flags %#x.\n", iface, flags);
2710
2712}
static HRESULT WINAPI ddraw_surface7_PageLock(IDirectDrawSurface7 *iface, DWORD Flags)
Definition: surface.c:2679

◆ ddraw_surface2_PageUnlock()

static HRESULT WINAPI ddraw_surface2_PageUnlock ( IDirectDrawSurface2 *  iface,
DWORD  flags 
)
static

Definition at line 2751 of file surface.c.

2752{
2753 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
2754
2755 TRACE("iface %p, flags %#x.\n", iface, flags);
2756
2758}
static HRESULT WINAPI ddraw_surface7_PageUnlock(IDirectDrawSurface7 *iface, DWORD Flags)
Definition: surface.c:2726

◆ ddraw_surface2_QueryInterface()

static HRESULT WINAPI ddraw_surface2_QueryInterface ( IDirectDrawSurface2 *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 269 of file surface.c.

270{
271 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
272
273 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
274
276}

◆ ddraw_surface2_Release()

static ULONG WINAPI ddraw_surface2_Release ( IDirectDrawSurface2 *  iface)
static

Definition at line 646 of file surface.c.

647{
649 ULONG refcount = InterlockedDecrement(&This->ref2);
650
651 TRACE("iface %p decreasing refcount to %u.\n", iface, refcount);
652
653 if (refcount == 0)
654 {
656 }
657
658 return refcount;
659}

◆ ddraw_surface2_ReleaseDC()

static HRESULT WINAPI ddraw_surface2_ReleaseDC ( IDirectDrawSurface2 *  iface,
HDC  dc 
)
static

Definition at line 2352 of file surface.c.

2353{
2354 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
2355
2356 TRACE("iface %p, dc %p.\n", iface, dc);
2357
2359}

◆ ddraw_surface2_Restore()

static HRESULT WINAPI ddraw_surface2_Restore ( IDirectDrawSurface2 *  iface)
static

Definition at line 3734 of file surface.c.

3735{
3736 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3737
3738 TRACE("iface %p.\n", iface);
3739
3741}

◆ ddraw_surface2_SetClipper()

static HRESULT WINAPI ddraw_surface2_SetClipper ( IDirectDrawSurface2 *  iface,
IDirectDrawClipper *  clipper 
)
static

Definition at line 4513 of file surface.c.

4514{
4515 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
4516
4517 TRACE("iface %p, clipper %p.\n", iface, clipper);
4518
4520}

◆ ddraw_surface2_SetColorKey()

static HRESULT WINAPI ddraw_surface2_SetColorKey ( IDirectDrawSurface2 *  iface,
DWORD  flags,
DDCOLORKEY color_key 
)
static

Definition at line 4887 of file surface.c.

4888{
4889 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
4890
4891 TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
4892
4894}

◆ ddraw_surface2_SetOverlayPosition()

static HRESULT WINAPI ddraw_surface2_SetOverlayPosition ( IDirectDrawSurface2 *  iface,
LONG  x,
LONG  y 
)
static

Definition at line 3797 of file surface.c.

3798{
3799 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3800
3801 TRACE("iface %p, x %d, y %d.\n", iface, x, y);
3802
3804}

◆ ddraw_surface2_SetPalette()

static HRESULT WINAPI ddraw_surface2_SetPalette ( IDirectDrawSurface2 *  iface,
IDirectDrawPalette *  palette 
)
static

Definition at line 4952 of file surface.c.

4953{
4954 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
4955
4956 TRACE("iface %p, palette %p.\n", iface, palette);
4957
4958 if (IDirectDrawSurface2_IsLost(iface) == DDERR_SURFACELOST)
4959 {
4960 WARN("Surface lost, returning DDERR_SURFACELOST.\n");
4961 return DDERR_SURFACELOST;
4962 }
4963
4964 return ddraw_surface_set_palette(surface, palette);
4965}

◆ ddraw_surface2_Unlock()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_Unlock ( IDirectDrawSurface2 *  iface,
void data 
)
static

Definition at line 1207 of file surface.c.

1208{
1209 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
1210
1211 TRACE("iface %p, data %p.\n", iface, data);
1212
1213 /* data might not be the LPRECT of later versions, so drop it. */
1215}

◆ ddraw_surface2_UpdateOverlay()

static HRESULT WINAPI ddraw_surface2_UpdateOverlay ( IDirectDrawSurface2 *  iface,
RECT src_rect,
IDirectDrawSurface2 *  dst_surface,
RECT dst_rect,
DWORD  flags,
DDOVERLAYFX fx 
)
static

Definition at line 3891 of file surface.c.

3893{
3894 struct ddraw_surface *src_impl = impl_from_IDirectDrawSurface2(iface);
3895 struct ddraw_surface *dst_impl = unsafe_impl_from_IDirectDrawSurface2(dst_surface);
3896
3897 TRACE("iface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n",
3898 iface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx);
3899
3900 return ddraw_surface7_UpdateOverlay(&src_impl->IDirectDrawSurface7_iface, src_rect,
3901 dst_impl ? &dst_impl->IDirectDrawSurface7_iface : NULL, dst_rect, flags, fx);
3902}

◆ ddraw_surface2_UpdateOverlayDisplay()

static HRESULT WINAPI ddraw_surface2_UpdateOverlayDisplay ( IDirectDrawSurface2 *  iface,
DWORD  flags 
)
static

Definition at line 3953 of file surface.c.

3954{
3955 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
3956
3957 TRACE("iface %p, flags %#x.\n", iface, flags);
3958
3960}

◆ ddraw_surface2_UpdateOverlayZOrder()

static HRESULT WINAPI ddraw_surface2_UpdateOverlayZOrder ( IDirectDrawSurface2 *  iface,
DWORD  flags,
IDirectDrawSurface2 *  reference 
)
static

Definition at line 4027 of file surface.c.

4029{
4030 struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
4032
4033 TRACE("iface %p, flags %#x, reference %p.\n", iface, flags, reference);
4034
4036 reference_impl ? &reference_impl->IDirectDrawSurface7_iface : NULL);
4037}

◆ ddraw_surface3_AddAttachedSurface()

static HRESULT WINAPI ddraw_surface3_AddAttachedSurface ( IDirectDrawSurface3 *  iface,
IDirectDrawSurface3 *  attachment 
)
static

Definition at line 1953 of file surface.c.

1954{
1955 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
1957 HRESULT hr;
1958
1959 TRACE("iface %p, attachment %p.\n", iface, attachment);
1960
1962 attachment_impl ? &attachment_impl->IDirectDrawSurface4_iface : NULL)))
1963 return hr;
1964
1965 attachment_impl->attached_iface = (IUnknown *)attachment;
1966 IUnknown_AddRef(attachment_impl->attached_iface);
1968 return hr;
1969}
static struct ddraw_surface * impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface)
static struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface)
Definition: surface.c:5673

◆ ddraw_surface3_AddOverlayDirtyRect()

static HRESULT WINAPI ddraw_surface3_AddOverlayDirtyRect ( IDirectDrawSurface3 *  iface,
RECT rect 
)
static

Definition at line 2168 of file surface.c.

2169{
2170 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
2171
2172 TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(rect));
2173
2175}

◆ ddraw_surface3_AddRef()

static ULONG WINAPI ddraw_surface3_AddRef ( IDirectDrawSurface3 *  iface)
static

Definition at line 371 of file surface.c.

372{
374 ULONG refcount = InterlockedIncrement(&This->ref3);
375
376 TRACE("iface %p increasing refcount to %u.\n", iface, refcount);
377
378 if (refcount == 1)
379 {
381 }
382
383 return refcount;
384}

Referenced by ddraw_surface3_GetAttachedSurface().

◆ ddraw_surface3_Blt()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_Blt ( IDirectDrawSurface3 *  iface,
RECT dst_rect,
IDirectDrawSurface3 *  src_surface,
RECT src_rect,
DWORD  flags,
DDBLTFX fx 
)
static

Definition at line 1768 of file surface.c.

1770{
1772 struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface3(src_surface);
1773
1774 TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n",
1775 iface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx);
1776
1777 return ddraw_surface7_Blt(&dst->IDirectDrawSurface7_iface, dst_rect,
1778 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags, fx);
1779}

◆ ddraw_surface3_BltBatch()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_BltBatch ( IDirectDrawSurface3 *  iface,
DDBLTBATCH batch,
DWORD  count,
DWORD  flags 
)
static

Definition at line 2789 of file surface.c.

2790{
2791 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
2792
2793 TRACE("iface %p, batch %p, count %u, flags %#x.\n", iface, batch, count, flags);
2794
2796}

◆ ddraw_surface3_BltFast()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_BltFast ( IDirectDrawSurface3 *  iface,
DWORD  dst_x,
DWORD  dst_y,
IDirectDrawSurface3 *  src_surface,
RECT src_rect,
DWORD  flags 
)
static

Definition at line 4322 of file surface.c.

4324{
4325 struct ddraw_surface *dst_impl = impl_from_IDirectDrawSurface3(iface);
4326 struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface3(src_surface);
4327
4328 TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n",
4329 iface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), flags);
4330
4331 return ddraw_surface7_BltFast(&dst_impl->IDirectDrawSurface7_iface, dst_x, dst_y,
4332 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags);
4333}

◆ ddraw_surface3_DeleteAttachedSurface()

static HRESULT WINAPI ddraw_surface3_DeleteAttachedSurface ( IDirectDrawSurface3 *  iface,
DWORD  flags,
IDirectDrawSurface3 *  attachment 
)
static

Definition at line 2107 of file surface.c.

2109{
2110 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
2112
2113 TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment);
2114
2115 return ddraw_surface_delete_attached_surface(surface, attachment_impl, (IUnknown *)attachment);
2116}

◆ ddraw_surface3_EnumAttachedSurfaces()

static HRESULT WINAPI ddraw_surface3_EnumAttachedSurfaces ( IDirectDrawSurface3 *  iface,
void context,
LPDDENUMSURFACESCALLBACK  callback 
)
static

Definition at line 2931 of file surface.c.

2933{
2934 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
2935 struct callback_info info;
2936
2937 TRACE("iface %p, context %p, callback %p.\n", iface, context, callback);
2938
2939 info.callback = callback;
2940 info.context = context;
2941
2943 &info, EnumCallback);
2944}

◆ ddraw_surface3_EnumOverlayZOrders()

static HRESULT WINAPI ddraw_surface3_EnumOverlayZOrders ( IDirectDrawSurface3 *  iface,
DWORD  flags,
void context,
LPDDENUMSURFACESCALLBACK  callback 
)
static

Definition at line 3013 of file surface.c.

3015{
3016 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3017 struct callback_info info;
3018
3019 TRACE("iface %p, flags %#x, context %p, callback %p.\n", iface, flags, context, callback);
3020
3021 info.callback = callback;
3022 info.context = context;
3023
3026}

◆ ddraw_surface3_Flip()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_Flip ( IDirectDrawSurface3 *  iface,
IDirectDrawSurface3 *  src,
DWORD  flags 
)
static

Definition at line 1371 of file surface.c.

1373{
1374 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
1376
1377 TRACE("iface %p, src %p, flags %#x.\n", iface, src, flags);
1378
1380 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, flags);
1381}

◆ ddraw_surface3_GetAttachedSurface()

static HRESULT WINAPI ddraw_surface3_GetAttachedSurface ( IDirectDrawSurface3 *  iface,
DDSCAPS caps,
IDirectDrawSurface3 **  attachment 
)
static

Definition at line 847 of file surface.c.

849{
850 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
851 struct ddraw_surface *attachment_impl;
852 IDirectDrawSurface7 *attachment7;
853 DDSCAPS2 caps2;
854 HRESULT hr;
855
856 TRACE("iface %p, caps %p, attachment %p.\n", iface, caps, attachment);
857
858 caps2.dwCaps = caps->dwCaps;
859 caps2.dwCaps2 = 0;
860 caps2.dwCaps3 = 0;
861 caps2.u1.dwCaps4 = 0;
862
864 &caps2, &attachment7);
865 if (FAILED(hr))
866 {
867 *attachment = NULL;
868 return hr;
869 }
870 attachment_impl = impl_from_IDirectDrawSurface7(attachment7);
871 *attachment = &attachment_impl->IDirectDrawSurface3_iface;
873 ddraw_surface7_Release(attachment7);
874
875 return hr;
876}
static ULONG WINAPI ddraw_surface3_AddRef(IDirectDrawSurface3 *iface)
Definition: surface.c:371

◆ ddraw_surface3_GetBltStatus()

static HRESULT WINAPI ddraw_surface3_GetBltStatus ( IDirectDrawSurface3 *  iface,
DWORD  flags 
)
static

Definition at line 3091 of file surface.c.

3092{
3093 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3094
3095 TRACE("iface %p, flags %#x.\n", iface, flags);
3096
3098}

◆ ddraw_surface3_GetCaps()

static HRESULT WINAPI ddraw_surface3_GetCaps ( IDirectDrawSurface3 *  iface,
DDSCAPS caps 
)
static

Definition at line 2406 of file surface.c.

2407{
2408 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
2409 DDSCAPS2 caps2;
2410 HRESULT hr;
2411
2412 TRACE("iface %p, caps %p.\n", iface, caps);
2413
2415 if (FAILED(hr)) return hr;
2416
2417 caps->dwCaps = caps2.dwCaps;
2418 return hr;
2419}

◆ ddraw_surface3_GetClipper()

static HRESULT WINAPI ddraw_surface3_GetClipper ( IDirectDrawSurface3 *  iface,
IDirectDrawClipper **  clipper 
)
static

Definition at line 4408 of file surface.c.

4409{
4410 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
4411
4412 TRACE("iface %p, clipper %p.\n", iface, clipper);
4413
4415}

◆ ddraw_surface3_GetColorKey()

static HRESULT WINAPI ddraw_surface3_GetColorKey ( IDirectDrawSurface3 *  iface,
DWORD  flags,
DDCOLORKEY color_key 
)
static

Definition at line 3200 of file surface.c.

3201{
3202 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3203
3204 TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
3205
3207}

◆ ddraw_surface3_GetDC()

static HRESULT WINAPI ddraw_surface3_GetDC ( IDirectDrawSurface3 *  iface,
HDC dc 
)
static

Definition at line 2269 of file surface.c.

2270{
2271 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
2272
2273 TRACE("iface %p, dc %p.\n", iface, dc);
2274
2276}

◆ ddraw_surface3_GetDDInterface()

static HRESULT WINAPI ddraw_surface3_GetDDInterface ( IDirectDrawSurface3 *  iface,
void **  ddraw 
)
static

Definition at line 4107 of file surface.c.

4108{
4109 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
4110
4111 TRACE("iface %p, ddraw %p.\n", iface, ddraw);
4112
4114}

◆ ddraw_surface3_GetFlipStatus()

static HRESULT WINAPI ddraw_surface3_GetFlipStatus ( IDirectDrawSurface3 *  iface,
DWORD  flags 
)
static

Definition at line 3262 of file surface.c.

3263{
3264 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3265
3266 TRACE("iface %p, flags %#x.\n", iface, flags);
3267
3269}

◆ ddraw_surface3_GetOverlayPosition()

static HRESULT WINAPI ddraw_surface3_GetOverlayPosition ( IDirectDrawSurface3 *  iface,
LONG x,
LONG y 
)
static

Definition at line 3325 of file surface.c.

3326{
3327 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3328
3329 TRACE("iface %p, x %p, y %p.\n", iface, x, y);
3330
3332}

◆ ddraw_surface3_GetPalette()

static HRESULT WINAPI ddraw_surface3_GetPalette ( IDirectDrawSurface3 *  iface,
IDirectDrawPalette **  palette 
)
static

Definition at line 4748 of file surface.c.

4749{
4750 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
4751
4752 TRACE("iface %p, palette %p.\n", iface, palette);
4753
4755}

◆ ddraw_surface3_GetPixelFormat()

static HRESULT WINAPI ddraw_surface3_GetPixelFormat ( IDirectDrawSurface3 *  iface,
DDPIXELFORMAT pixel_format 
)
static

Definition at line 3392 of file surface.c.

3393{
3394 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3395
3396 TRACE("iface %p, pixel_format %p.\n", iface, pixel_format);
3397
3399}

◆ ddraw_surface3_GetSurfaceDesc()

static HRESULT WINAPI ddraw_surface3_GetSurfaceDesc ( IDirectDrawSurface3 *  iface,
DDSURFACEDESC surface_desc 
)
static

Definition at line 3466 of file surface.c.

3467{
3468 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3469
3470 TRACE("iface %p, surface_desc %p.\n", iface, surface_desc);
3471
3472 if (!surface_desc) return DDERR_INVALIDPARAMS;
3473
3474 if (surface_desc->dwSize != sizeof(DDSURFACEDESC))
3475 {
3476 WARN("Incorrect structure size %u, returning DDERR_INVALIDPARAMS.\n", surface_desc->dwSize);
3477 return DDERR_INVALIDPARAMS;
3478 }
3479
3482 TRACE("Returning surface desc:\n");
3483 if (TRACE_ON(ddraw))
3484 {
3485 /* DDRAW_dump_surface_desc handles the smaller size */
3487 }
3489
3490 return DD_OK;
3491}
void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd) DECLSPEC_HIDDEN
Definition: utils.c:864
#define TRACE_ON(x)
Definition: compat.h:75

Referenced by ddraw_surface1_GetSurfaceDesc(), and ddraw_surface2_GetSurfaceDesc().

◆ ddraw_surface3_Initialize()

static HRESULT WINAPI ddraw_surface3_Initialize ( IDirectDrawSurface3 *  iface,
IDirectDraw *  ddraw,
DDSURFACEDESC surface_desc 
)
static

Definition at line 3543 of file surface.c.

3545{
3546 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3547 DDSURFACEDESC2 surface_desc2;
3548
3549 TRACE("iface %p, ddraw %p, surface_desc %p.\n", iface, ddraw, surface_desc);
3550
3551 if (surface_desc) DDSD_to_DDSD2(surface_desc, &surface_desc2);
3553 ddraw, surface_desc ? &surface_desc2 : NULL);
3554}

◆ ddraw_surface3_IsLost()

static HRESULT WINAPI ddraw_surface3_IsLost ( IDirectDrawSurface3 *  iface)
static

Definition at line 3633 of file surface.c.

3634{
3635 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3636
3637 TRACE("iface %p.\n", iface);
3638
3640}

◆ ddraw_surface3_Lock()

static HRESULT WINAPI ddraw_surface3_Lock ( IDirectDrawSurface3 *  iface,
RECT rect,
DDSURFACEDESC surface_desc,
DWORD  flags,
HANDLE  h 
)
static

Definition at line 1094 of file surface.c.

1096{
1097 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
1098 unsigned int surface_desc_size;
1099 DDSURFACEDESC2 surface_desc2;
1100 HRESULT hr;
1101
1102 TRACE("iface %p, rect %s, surface_desc %p, flags %#x, h %p.\n",
1104
1105 if (!surface_validate_lock_desc(surface, surface_desc, &surface_desc_size))
1106 return DDERR_INVALIDPARAMS;
1107
1108 surface_desc2.dwSize = surface_desc->dwSize;
1109 surface_desc2.dwFlags = 0;
1110 hr = surface_lock(surface, rect, &surface_desc2, surface_desc_size, flags, h);
1111 DDSD2_to_DDSD(&surface_desc2, surface_desc);
1112 surface_desc->dwSize = surface_desc2.dwSize;
1113 return hr;
1114}

◆ ddraw_surface3_PageLock()

static HRESULT WINAPI ddraw_surface3_PageLock ( IDirectDrawSurface3 *  iface,
DWORD  flags 
)
static

Definition at line 2696 of file surface.c.

2697{
2698 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
2699
2700 TRACE("iface %p, flags %#x.\n", iface, flags);
2701
2703}

◆ ddraw_surface3_PageUnlock()

static HRESULT WINAPI ddraw_surface3_PageUnlock ( IDirectDrawSurface3 *  iface,
DWORD  flags 
)
static

Definition at line 2742 of file surface.c.

2743{
2744 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
2745
2746 TRACE("iface %p, flags %#x.\n", iface, flags);
2747
2749}

◆ ddraw_surface3_QueryInterface()

static HRESULT WINAPI ddraw_surface3_QueryInterface ( IDirectDrawSurface3 *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 260 of file surface.c.

261{
262 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
263
264 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
265
267}

◆ ddraw_surface3_Release()

static ULONG WINAPI ddraw_surface3_Release ( IDirectDrawSurface3 *  iface)
static

Definition at line 631 of file surface.c.

632{
634 ULONG refcount = InterlockedDecrement(&This->ref3);
635
636 TRACE("iface %p decreasing refcount to %u.\n", iface, refcount);
637
638 if (refcount == 0)
639 {
641 }
642
643 return refcount;
644}

◆ ddraw_surface3_ReleaseDC()

static HRESULT WINAPI ddraw_surface3_ReleaseDC ( IDirectDrawSurface3 *  iface,
HDC  dc 
)
static

Definition at line 2343 of file surface.c.

2344{
2345 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
2346
2347 TRACE("iface %p, dc %p.\n", iface, dc);
2348
2350}

◆ ddraw_surface3_Restore()

static HRESULT WINAPI ddraw_surface3_Restore ( IDirectDrawSurface3 *  iface)
static

Definition at line 3725 of file surface.c.

3726{
3727 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3728
3729 TRACE("iface %p.\n", iface);
3730
3732}

◆ ddraw_surface3_SetClipper()

static HRESULT WINAPI ddraw_surface3_SetClipper ( IDirectDrawSurface3 *  iface,
IDirectDrawClipper *  clipper 
)
static

Definition at line 4504 of file surface.c.

4505{
4506 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
4507
4508 TRACE("iface %p, clipper %p.\n", iface, clipper);
4509
4511}

◆ ddraw_surface3_SetColorKey()

static HRESULT WINAPI ddraw_surface3_SetColorKey ( IDirectDrawSurface3 *  iface,
DWORD  flags,
DDCOLORKEY color_key 
)
static

Definition at line 4878 of file surface.c.

4879{
4880 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
4881
4882 TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
4883
4885}

◆ ddraw_surface3_SetOverlayPosition()

static HRESULT WINAPI ddraw_surface3_SetOverlayPosition ( IDirectDrawSurface3 *  iface,
LONG  x,
LONG  y 
)
static

Definition at line 3788 of file surface.c.

3789{
3790 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3791
3792 TRACE("iface %p, x %d, y %d.\n", iface, x, y);
3793
3795}

◆ ddraw_surface3_SetPalette()

static HRESULT WINAPI ddraw_surface3_SetPalette ( IDirectDrawSurface3 *  iface,
IDirectDrawPalette *  palette 
)
static

Definition at line 4937 of file surface.c.

4938{
4939 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
4940
4941 TRACE("iface %p, palette %p.\n", iface, palette);
4942
4943 if (IDirectDrawSurface3_IsLost(iface) == DDERR_SURFACELOST)
4944 {
4945 WARN("Surface lost, returning DDERR_SURFACELOST.\n");
4946 return DDERR_SURFACELOST;
4947 }
4948
4949 return ddraw_surface_set_palette(surface, palette);
4950}

◆ ddraw_surface3_SetSurfaceDesc()

static HRESULT WINAPI ddraw_surface3_SetSurfaceDesc ( IDirectDrawSurface3 *  iface,
DDSURFACEDESC surface_desc,
DWORD  flags 
)
static

Definition at line 4694 of file surface.c.

4696{
4697 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
4698 DDSURFACEDESC2 surface_desc2;
4699
4700 TRACE("iface %p, surface_desc %p, flags %#x.\n", iface, surface_desc, flags);
4701
4702 if (surface_desc) DDSD_to_DDSD2(surface_desc, &surface_desc2);
4704 surface_desc ? &surface_desc2 : NULL, flags);
4705}
static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface, DDSURFACEDESC2 *DDSD, DWORD Flags)
Definition: surface.c:4547

◆ ddraw_surface3_Unlock()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_Unlock ( IDirectDrawSurface3 *  iface,
void data 
)
static

Definition at line 1197 of file surface.c.

1198{
1199 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
1200
1201 TRACE("iface %p, data %p.\n", iface, data);
1202
1203 /* data might not be the LPRECT of later versions, so drop it. */
1205}

◆ ddraw_surface3_UpdateOverlay()

static HRESULT WINAPI ddraw_surface3_UpdateOverlay ( IDirectDrawSurface3 *  iface,
RECT src_rect,
IDirectDrawSurface3 *  dst_surface,
RECT dst_rect,
DWORD  flags,
DDOVERLAYFX fx 
)
static

Definition at line 3878 of file surface.c.

3880{
3881 struct ddraw_surface *src_impl = impl_from_IDirectDrawSurface3(iface);
3882 struct ddraw_surface *dst_impl = unsafe_impl_from_IDirectDrawSurface3(dst_surface);
3883
3884 TRACE("iface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n",
3885 iface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx);
3886
3887 return ddraw_surface7_UpdateOverlay(&src_impl->IDirectDrawSurface7_iface, src_rect,
3888 dst_impl ? &dst_impl->IDirectDrawSurface7_iface : NULL, dst_rect, flags, fx);
3889}

◆ ddraw_surface3_UpdateOverlayDisplay()

static HRESULT WINAPI ddraw_surface3_UpdateOverlayDisplay ( IDirectDrawSurface3 *  iface,
DWORD  flags 
)
static

Definition at line 3944 of file surface.c.

3945{
3946 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
3947
3948 TRACE("iface %p, flags %#x.\n", iface, flags);
3949
3951}

◆ ddraw_surface3_UpdateOverlayZOrder()

static HRESULT WINAPI ddraw_surface3_UpdateOverlayZOrder ( IDirectDrawSurface3 *  iface,
DWORD  flags,
IDirectDrawSurface3 *  reference 
)
static

Definition at line 4015 of file surface.c.

4017{
4018 struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
4020
4021 TRACE("iface %p, flags %#x, reference %p.\n", iface, flags, reference);
4022
4024 reference_impl ? &reference_impl->IDirectDrawSurface7_iface : NULL);
4025}

◆ ddraw_surface4_AddAttachedSurface()

static HRESULT WINAPI ddraw_surface4_AddAttachedSurface ( IDirectDrawSurface4 *  iface,
IDirectDrawSurface4 *  attachment 
)
static

Definition at line 1914 of file surface.c.

1915{
1916 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
1918 HRESULT hr;
1919
1920 TRACE("iface %p, attachment %p.\n", iface, attachment);
1921
1922 /* Tests suggest that
1923 * -> offscreen plain surfaces can be attached to other offscreen plain surfaces
1924 * -> offscreen plain surfaces can be attached to primaries
1925 * -> primaries can be attached to offscreen plain surfaces
1926 * -> z buffers can be attached to primaries */
1929 {
1930 /* Sizes have to match */
1931 if (attachment_impl->surface_desc.dwWidth != surface->surface_desc.dwWidth
1932 || attachment_impl->surface_desc.dwHeight != surface->surface_desc.dwHeight)
1933 {
1934 WARN("Surface sizes do not match.\n");
1936 }
1937 }
1939 || !(attachment_impl->surface_desc.ddsCaps.dwCaps & (DDSCAPS_ZBUFFER)))
1940 {
1941 WARN("Invalid attachment combination.\n");
1943 }
1944
1945 if (FAILED(hr = ddraw_surface_attach_surface(surface, attachment_impl)))
1946 return hr;
1947
1948 attachment_impl->attached_iface = (IUnknown *)attachment;
1949 IUnknown_AddRef(attachment_impl->attached_iface);
1950 return hr;
1951}
static struct ddraw_surface * impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface)
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface)
Definition: surface.c:5657
static HRESULT ddraw_surface_attach_surface(struct ddraw_surface *This, struct ddraw_surface *Surf)
Definition: surface.c:1851
#define DDSCAPS_ZBUFFER
Definition: ddraw.h:267
#define DDERR_CANNOTATTACHSURFACE
Definition: ddraw.h:68
#define DDSCAPS_OFFSCREENPLAIN
Definition: ddraw.h:255
#define DDSCAPS_3DDEVICE
Definition: ddraw.h:263

Referenced by ddraw_surface1_AddAttachedSurface(), ddraw_surface2_AddAttachedSurface(), and ddraw_surface3_AddAttachedSurface().

◆ ddraw_surface4_AddOverlayDirtyRect()

static HRESULT WINAPI ddraw_surface4_AddOverlayDirtyRect ( IDirectDrawSurface4 *  iface,
RECT rect 
)
static

Definition at line 2159 of file surface.c.

2160{
2161 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2162
2163 TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(rect));
2164
2166}

◆ ddraw_surface4_AddRef()

static ULONG WINAPI ddraw_surface4_AddRef ( IDirectDrawSurface4 *  iface)
static

Definition at line 356 of file surface.c.

357{
359 ULONG refcount = InterlockedIncrement(&This->ref4);
360
361 TRACE("iface %p increasing refcount to %u.\n", iface, refcount);
362
363 if (refcount == 1)
364 {
366 }
367
368 return refcount;
369}

Referenced by ddraw_surface4_GetAttachedSurface(), and EnumCallback2().

◆ ddraw_surface4_Blt()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_Blt ( IDirectDrawSurface4 *  iface,
RECT dst_rect,
IDirectDrawSurface4 *  src_surface,
RECT src_rect,
DWORD  flags,
DDBLTFX fx 
)
static

Definition at line 1755 of file surface.c.

1757{
1760
1761 TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n",
1762 iface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx);
1763
1764 return ddraw_surface7_Blt(&dst->IDirectDrawSurface7_iface, dst_rect,
1765 src ? &src->IDirectDrawSurface7_iface : NULL, src_rect, flags, fx);
1766}

◆ ddraw_surface4_BltBatch()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_BltBatch ( IDirectDrawSurface4 *  iface,
DDBLTBATCH batch,
DWORD  count,
DWORD  flags 
)
static

Definition at line 2780 of file surface.c.

2781{
2782 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2783
2784 TRACE("iface %p, batch %p, count %u, flags %#x.\n", iface, batch, count, flags);
2785
2787}

◆ ddraw_surface4_BltFast()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_BltFast ( IDirectDrawSurface4 *  iface,
DWORD  dst_x,
DWORD  dst_y,
IDirectDrawSurface4 *  src_surface,
RECT src_rect,
DWORD  flags 
)
static

Definition at line 4309 of file surface.c.

4311{
4312 struct ddraw_surface *dst_impl = impl_from_IDirectDrawSurface4(iface);
4313 struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface4(src_surface);
4314
4315 TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n",
4316 iface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), flags);
4317
4318 return ddraw_surface7_BltFast(&dst_impl->IDirectDrawSurface7_iface, dst_x, dst_y,
4319 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags);
4320}

◆ ddraw_surface4_ChangeUniquenessValue()

static HRESULT WINAPI ddraw_surface4_ChangeUniquenessValue ( IDirectDrawSurface4 *  iface)
static

Definition at line 4132 of file surface.c.

4133{
4134 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
4135
4136 TRACE("iface %p.\n", iface);
4137
4139}
static HRESULT WINAPI ddraw_surface7_ChangeUniquenessValue(IDirectDrawSurface7 *iface)
Definition: surface.c:4125

◆ ddraw_surface4_DeleteAttachedSurface()

static HRESULT WINAPI ddraw_surface4_DeleteAttachedSurface ( IDirectDrawSurface4 *  iface,
DWORD  flags,
IDirectDrawSurface4 *  attachment 
)
static

Definition at line 2096 of file surface.c.

2098{
2099 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2101
2102 TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment);
2103
2104 return ddraw_surface_delete_attached_surface(surface, attachment_impl, (IUnknown *)attachment);
2105}

◆ ddraw_surface4_EnumAttachedSurfaces()

static HRESULT WINAPI ddraw_surface4_EnumAttachedSurfaces ( IDirectDrawSurface4 *  iface,
void context,
LPDDENUMSURFACESCALLBACK2  callback 
)
static

Definition at line 2916 of file surface.c.

2918{
2919 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2920 struct callback_info2 info;
2921
2922 TRACE("iface %p, context %p, callback %p.\n", iface, context, callback);
2923
2924 info.callback = callback;
2925 info.context = context;
2926
2929}
static HRESULT CALLBACK EnumCallback2(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *surface_desc, void *context)
Definition: surface.c:2892
void * context
Definition: surface.c:2883

◆ ddraw_surface4_EnumOverlayZOrders()

static HRESULT WINAPI ddraw_surface4_EnumOverlayZOrders ( IDirectDrawSurface4 *  iface,
DWORD  flags,
void context,
LPDDENUMSURFACESCALLBACK2  callback 
)
static

Definition at line 2998 of file surface.c.

3000{
3001 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3002 struct callback_info2 info;
3003
3004 TRACE("iface %p, flags %#x, context %p, callback %p.\n", iface, flags, context, callback);
3005
3006 info.callback = callback;
3007 info.context = context;
3008
3011}

◆ ddraw_surface4_Flip()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_Flip ( IDirectDrawSurface4 *  iface,
IDirectDrawSurface4 *  src,
DWORD  flags 
)
static

Definition at line 1359 of file surface.c.

1361{
1362 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
1364
1365 TRACE("iface %p, src %p, flags %#x.\n", iface, src, flags);
1366
1368 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, flags);
1369}

◆ ddraw_surface4_FreePrivateData()

static HRESULT WINAPI ddraw_surface4_FreePrivateData ( IDirectDrawSurface4 *  iface,
REFGUID  tag 
)
static

Definition at line 2658 of file surface.c.

2659{
2660 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2661
2662 TRACE("iface %p, tag %s.\n", iface, debugstr_guid(tag));
2663
2665}
static HRESULT WINAPI ddraw_surface7_FreePrivateData(IDirectDrawSurface7 *iface, REFGUID tag)
Definition: surface.c:2637
Definition: ecma_167.h:138

◆ ddraw_surface4_GetAttachedSurface()

static HRESULT WINAPI ddraw_surface4_GetAttachedSurface ( IDirectDrawSurface4 *  iface,
DDSCAPS2 caps,
IDirectDrawSurface4 **  attachment 
)
static

Definition at line 822 of file surface.c.

824{
825 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
826 struct ddraw_surface *attachment_impl;
827 IDirectDrawSurface7 *attachment7;
828 HRESULT hr;
829
830 TRACE("iface %p, caps %p, attachment %p.\n", iface, caps, attachment);
831
833 caps, &attachment7);
834 if (FAILED(hr))
835 {
836 *attachment = NULL;
837 return hr;
838 }
839 attachment_impl = impl_from_IDirectDrawSurface7(attachment7);
840 *attachment = &attachment_impl->IDirectDrawSurface4_iface;
842 ddraw_surface7_Release(attachment7);
843
844 return hr;
845}
static ULONG WINAPI ddraw_surface4_AddRef(IDirectDrawSurface4 *iface)
Definition: surface.c:356

◆ ddraw_surface4_GetBltStatus()

static HRESULT WINAPI ddraw_surface4_GetBltStatus ( IDirectDrawSurface4 *  iface,
DWORD  flags 
)
static

Definition at line 3082 of file surface.c.

3083{
3084 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3085
3086 TRACE("iface %p, flags %#x.\n", iface, flags);
3087
3089}

◆ ddraw_surface4_GetCaps()

static HRESULT WINAPI ddraw_surface4_GetCaps ( IDirectDrawSurface4 *  iface,
DDSCAPS2 caps 
)
static

Definition at line 2397 of file surface.c.

2398{
2399 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2400
2401 TRACE("iface %p, caps %p.\n", iface, caps);
2402
2403 return ddraw_surface7_GetCaps(&surface->IDirectDrawSurface7_iface, caps);
2404}

◆ ddraw_surface4_GetClipper()

static HRESULT WINAPI ddraw_surface4_GetClipper ( IDirectDrawSurface4 *  iface,
IDirectDrawClipper **  clipper 
)
static

Definition at line 4399 of file surface.c.

4400{
4401 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
4402
4403 TRACE("iface %p, clipper %p.\n", iface, clipper);
4404
4406}

◆ ddraw_surface4_GetColorKey()

static HRESULT WINAPI ddraw_surface4_GetColorKey ( IDirectDrawSurface4 *  iface,
DWORD  flags,
DDCOLORKEY color_key 
)
static

Definition at line 3191 of file surface.c.

3192{
3193 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3194
3195 TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
3196
3198}

◆ ddraw_surface4_GetDC()

static HRESULT WINAPI ddraw_surface4_GetDC ( IDirectDrawSurface4 *  iface,
HDC dc 
)
static

Definition at line 2260 of file surface.c.

2261{
2262 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2263
2264 TRACE("iface %p, dc %p.\n", iface, dc);
2265
2267}

◆ ddraw_surface4_GetDDInterface()

static HRESULT WINAPI ddraw_surface4_GetDDInterface ( IDirectDrawSurface4 *  iface,
void **  ddraw 
)
static

Definition at line 4098 of file surface.c.

4099{
4100 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
4101
4102 TRACE("iface %p, ddraw %p.\n", iface, ddraw);
4103
4105}

◆ ddraw_surface4_GetFlipStatus()

static HRESULT WINAPI ddraw_surface4_GetFlipStatus ( IDirectDrawSurface4 *  iface,
DWORD  flags 
)
static

Definition at line 3253 of file surface.c.

3254{
3255 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3256
3257 TRACE("iface %p, flags %#x.\n", iface, flags);
3258
3260}

◆ ddraw_surface4_GetOverlayPosition()

static HRESULT WINAPI ddraw_surface4_GetOverlayPosition ( IDirectDrawSurface4 *  iface,
LONG x,
LONG y 
)
static

Definition at line 3316 of file surface.c.

3317{
3318 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3319
3320 TRACE("iface %p, x %p, y %p.\n", iface, x, y);
3321
3323}

◆ ddraw_surface4_GetPalette()

static HRESULT WINAPI ddraw_surface4_GetPalette ( IDirectDrawSurface4 *  iface,
IDirectDrawPalette **  palette 
)
static

Definition at line 4739 of file surface.c.

4740{
4741 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
4742
4743 TRACE("iface %p, palette %p.\n", iface, palette);
4744
4746}

◆ ddraw_surface4_GetPixelFormat()

static HRESULT WINAPI ddraw_surface4_GetPixelFormat ( IDirectDrawSurface4 *  iface,
DDPIXELFORMAT pixel_format 
)
static

Definition at line 3383 of file surface.c.

3384{
3385 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3386
3387 TRACE("iface %p, pixel_format %p.\n", iface, pixel_format);
3388
3390}

◆ ddraw_surface4_GetPrivateData()

static HRESULT WINAPI ddraw_surface4_GetPrivateData ( IDirectDrawSurface4 *  iface,
REFGUID  tag,
void data,
DWORD size 
)
static

Definition at line 2615 of file surface.c.

2616{
2617 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2618
2619 TRACE("iface %p, tag %s, data %p, data_size %p.\n",
2620 iface, debugstr_guid(tag), data, size);
2621
2623}
static HRESULT WINAPI ddraw_surface7_GetPrivateData(IDirectDrawSurface7 *iface, REFGUID tag, void *data, DWORD *size)
Definition: surface.c:2573
GLsizeiptr size
Definition: glext.h:5919

◆ ddraw_surface4_GetSurfaceDesc()

static HRESULT WINAPI ddraw_surface4_GetSurfaceDesc ( IDirectDrawSurface4 *  iface,
DDSURFACEDESC2 DDSD 
)
static

Definition at line 3457 of file surface.c.

3458{
3459 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3460
3461 TRACE("iface %p, surface_desc %p.\n", iface, DDSD);
3462
3464}
static HRESULT WINAPI ddraw_surface7_GetSurfaceDesc(IDirectDrawSurface7 *iface, DDSURFACEDESC2 *DDSD)
Definition: surface.c:3433

◆ ddraw_surface4_GetUniquenessValue()

static HRESULT WINAPI ddraw_surface4_GetUniquenessValue ( IDirectDrawSurface4 *  iface,
DWORD pValue 
)
static

Definition at line 4150 of file surface.c.

4151{
4152 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
4153
4154 TRACE("iface %p, value %p.\n", iface, pValue);
4155
4157}
static HRESULT WINAPI ddraw_surface7_GetUniquenessValue(IDirectDrawSurface7 *iface, DWORD *pValue)
Definition: surface.c:4141
PWCHAR pValue

◆ ddraw_surface4_Initialize()

static HRESULT WINAPI ddraw_surface4_Initialize ( IDirectDrawSurface4 *  iface,
IDirectDraw *  ddraw,
DDSURFACEDESC2 surface_desc 
)
static

Definition at line 3532 of file surface.c.

3534{
3535 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3536
3537 TRACE("iface %p, ddraw %p, surface_desc %p.\n", iface, ddraw, surface_desc);
3538
3541}

◆ ddraw_surface4_IsLost()

static HRESULT WINAPI ddraw_surface4_IsLost ( IDirectDrawSurface4 *  iface)
static

Definition at line 3624 of file surface.c.

3625{
3626 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3627
3628 TRACE("iface %p.\n", iface);
3629
3631}

◆ ddraw_surface4_Lock()

static HRESULT WINAPI ddraw_surface4_Lock ( IDirectDrawSurface4 *  iface,
RECT rect,
DDSURFACEDESC2 surface_desc,
DWORD  flags,
HANDLE  h 
)
static

Definition at line 1079 of file surface.c.

1081{
1082 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
1083 unsigned int surface_desc_size;
1084
1085 TRACE("iface %p, rect %s, surface_desc %p, flags %#x, h %p.\n",
1087
1088 if (!surface_validate_lock_desc(surface, (DDSURFACEDESC *)surface_desc, &surface_desc_size))
1089 return DDERR_INVALIDPARAMS;
1090
1091 return surface_lock(surface, rect, surface_desc, surface_desc_size, flags, h);
1092}

◆ ddraw_surface4_PageLock()

static HRESULT WINAPI ddraw_surface4_PageLock ( IDirectDrawSurface4 *  iface,
DWORD  flags 
)
static

Definition at line 2687 of file surface.c.

2688{
2689 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2690
2691 TRACE("iface %p, flags %#x.\n", iface, flags);
2692
2694}

◆ ddraw_surface4_PageUnlock()

static HRESULT WINAPI ddraw_surface4_PageUnlock ( IDirectDrawSurface4 *  iface,
DWORD  flags 
)
static

Definition at line 2733 of file surface.c.

2734{
2735 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2736
2737 TRACE("iface %p, flags %#x.\n", iface, flags);
2738
2740}

◆ ddraw_surface4_QueryInterface()

static HRESULT WINAPI ddraw_surface4_QueryInterface ( IDirectDrawSurface4 *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 251 of file surface.c.

252{
253 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
254
255 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
256
258}

◆ ddraw_surface4_Release()

static ULONG WINAPI ddraw_surface4_Release ( IDirectDrawSurface4 *  iface)
static

Definition at line 616 of file surface.c.

617{
619 ULONG refcount = InterlockedDecrement(&This->ref4);
620
621 TRACE("iface %p decreasing refcount to %u.\n", iface, refcount);
622
623 if (refcount == 0)
624 {
626 }
627
628 return refcount;
629}

Referenced by ddraw_surface1_AddAttachedSurface(), ddraw_surface2_AddAttachedSurface(), and ddraw_surface3_AddAttachedSurface().

◆ ddraw_surface4_ReleaseDC()

static HRESULT WINAPI ddraw_surface4_ReleaseDC ( IDirectDrawSurface4 *  iface,
HDC  dc 
)
static

Definition at line 2334 of file surface.c.

2335{
2336 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2337
2338 TRACE("iface %p, dc %p.\n", iface, dc);
2339
2341}

◆ ddraw_surface4_Restore()

static HRESULT WINAPI ddraw_surface4_Restore ( IDirectDrawSurface4 *  iface)
static

Definition at line 3716 of file surface.c.

3717{
3718 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3719
3720 TRACE("iface %p.\n", iface);
3721
3723}

◆ ddraw_surface4_SetClipper()

static HRESULT WINAPI ddraw_surface4_SetClipper ( IDirectDrawSurface4 *  iface,
IDirectDrawClipper *  clipper 
)
static

Definition at line 4495 of file surface.c.

4496{
4497 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
4498
4499 TRACE("iface %p, clipper %p.\n", iface, clipper);
4500
4502}

◆ ddraw_surface4_SetColorKey()

static HRESULT WINAPI ddraw_surface4_SetColorKey ( IDirectDrawSurface4 *  iface,
DWORD  flags,
DDCOLORKEY color_key 
)
static

Definition at line 4869 of file surface.c.

4870{
4871 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
4872
4873 TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
4874
4876}

◆ ddraw_surface4_SetOverlayPosition()

static HRESULT WINAPI ddraw_surface4_SetOverlayPosition ( IDirectDrawSurface4 *  iface,
LONG  x,
LONG  y 
)
static

Definition at line 3779 of file surface.c.

3780{
3781 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3782
3783 TRACE("iface %p, x %d, y %d.\n", iface, x, y);
3784
3786}

◆ ddraw_surface4_SetPalette()

static HRESULT WINAPI ddraw_surface4_SetPalette ( IDirectDrawSurface4 *  iface,
IDirectDrawPalette *  palette 
)
static

Definition at line 4922 of file surface.c.

4923{
4924 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
4925
4926 TRACE("iface %p, palette %p.\n", iface, palette);
4927
4928 if (IDirectDrawSurface4_IsLost(iface) == DDERR_SURFACELOST)
4929 {
4930 WARN("Surface lost, returning DDERR_SURFACELOST.\n");
4931 return DDERR_SURFACELOST;
4932 }
4933
4934 return ddraw_surface_set_palette(surface, palette);
4935}

◆ ddraw_surface4_SetPrivateData()

static HRESULT WINAPI ddraw_surface4_SetPrivateData ( IDirectDrawSurface4 *  iface,
REFGUID  tag,
void data,
DWORD  size,
DWORD  flags 
)
static

Definition at line 2547 of file surface.c.

2549{
2550 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
2551
2552 TRACE("iface %p, tag %s, data %p, data_size %u, flags %#x.\n",
2553 iface, debugstr_guid(tag), data, size, flags);
2554
2556}
static HRESULT WINAPI ddraw_surface7_SetPrivateData(IDirectDrawSurface7 *iface, REFGUID tag, void *data, DWORD size, DWORD flags)
Definition: surface.c:2526

◆ ddraw_surface4_SetSurfaceDesc()

static HRESULT WINAPI ddraw_surface4_SetSurfaceDesc ( IDirectDrawSurface4 *  iface,
DDSURFACEDESC2 surface_desc,
DWORD  flags 
)
static

Definition at line 4683 of file surface.c.

4685{
4686 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
4687
4688 TRACE("iface %p, surface_desc %p, flags %#x.\n", iface, surface_desc, flags);
4689
4692}

◆ ddraw_surface4_Unlock()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_Unlock ( IDirectDrawSurface4 *  iface,
RECT pRect 
)
static

Definition at line 1188 of file surface.c.

1189{
1190 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
1191
1192 TRACE("iface %p, rect %p.\n", iface, pRect);
1193
1194 return ddraw_surface7_Unlock(&surface->IDirectDrawSurface7_iface, pRect);
1195}

◆ ddraw_surface4_UpdateOverlay()

static HRESULT WINAPI ddraw_surface4_UpdateOverlay ( IDirectDrawSurface4 *  iface,
RECT src_rect,
IDirectDrawSurface4 *  dst_surface,
RECT dst_rect,
DWORD  flags,
DDOVERLAYFX fx 
)
static

Definition at line 3865 of file surface.c.

3867{
3868 struct ddraw_surface *src_impl = impl_from_IDirectDrawSurface4(iface);
3869 struct ddraw_surface *dst_impl = unsafe_impl_from_IDirectDrawSurface4(dst_surface);
3870
3871 TRACE("iface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n",
3872 iface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx);
3873
3874 return ddraw_surface7_UpdateOverlay(&src_impl->IDirectDrawSurface7_iface, src_rect,
3875 dst_impl ? &dst_impl->IDirectDrawSurface7_iface : NULL, dst_rect, flags, fx);
3876}

◆ ddraw_surface4_UpdateOverlayDisplay()

static HRESULT WINAPI ddraw_surface4_UpdateOverlayDisplay ( IDirectDrawSurface4 *  iface,
DWORD  flags 
)
static

Definition at line 3935 of file surface.c.

3936{
3937 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
3938
3939 TRACE("iface %p, flags %#x.\n", iface, flags);
3940
3942}

◆ ddraw_surface4_UpdateOverlayZOrder()

static HRESULT WINAPI ddraw_surface4_UpdateOverlayZOrder ( IDirectDrawSurface4 *  iface,
DWORD  flags,
IDirectDrawSurface4 *  reference 
)
static

Definition at line 4003 of file surface.c.

4005{
4006 struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
4008
4009 TRACE("iface %p, flags %#x, reference %p.\n", iface, flags, reference);
4010
4012 reference_impl ? &reference_impl->IDirectDrawSurface7_iface : NULL);
4013}

◆ ddraw_surface7_AddAttachedSurface()

static HRESULT WINAPI ddraw_surface7_AddAttachedSurface ( IDirectDrawSurface7 iface,
IDirectDrawSurface7 attachment 
)
static

Definition at line 1887 of file surface.c.

1888{
1891 HRESULT hr;
1892
1893 TRACE("iface %p, attachment %p.\n", iface, attachment);
1894
1895 /* Version 7 of this interface seems to refuse everything except z buffers, as per msdn */
1896 if(!(attachment_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER))
1897 {
1898
1899 WARN("Application tries to attach a non Z buffer surface. caps %08x\n",
1900 attachment_impl->surface_desc.ddsCaps.dwCaps);
1902 }
1903
1904 hr = ddraw_surface_attach_surface(This, attachment_impl);
1905 if (FAILED(hr))
1906 {
1907 return hr;
1908 }
1909 attachment_impl->attached_iface = (IUnknown *)attachment;
1910 IUnknown_AddRef(attachment_impl->attached_iface);
1911 return hr;
1912}
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface)
Definition: surface.c:5641

◆ ddraw_surface7_AddOverlayDirtyRect()

static HRESULT WINAPI ddraw_surface7_AddOverlayDirtyRect ( IDirectDrawSurface7 iface,
RECT Rect 
)
static

Definition at line 2152 of file surface.c.

2153{
2154 TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(Rect));
2155
2156 return DDERR_UNSUPPORTED; /* unchecked */
2157}

Referenced by ddraw_surface1_AddOverlayDirtyRect(), ddraw_surface2_AddOverlayDirtyRect(), ddraw_surface3_AddOverlayDirtyRect(), and ddraw_surface4_AddOverlayDirtyRect().

◆ ddraw_surface7_AddRef()

static ULONG WINAPI ddraw_surface7_AddRef ( IDirectDrawSurface7 iface)
static

Definition at line 341 of file surface.c.

342{
344 ULONG refcount = InterlockedIncrement(&This->ref7);
345
346 TRACE("iface %p increasing refcount to %u.\n", iface, refcount);
347
348 if (refcount == 1)
349 {
351 }
352
353 return refcount;
354}

Referenced by ddraw_surface7_EnumAttachedSurfaces(), and ddraw_surface7_GetAttachedSurface().

◆ ddraw_surface7_Blt()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Blt ( IDirectDrawSurface7 iface,
RECT dst_rect,
IDirectDrawSurface7 src_surface,
RECT src_rect,
DWORD  flags,
DDBLTFX fx 
)
static

Definition at line 1574 of file surface.c.

1576{
1577 struct ddraw_surface *dst_impl = impl_from_IDirectDrawSurface7(iface);
1578 struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface7(src_surface);
1579 struct wined3d_blt_fx wined3d_fx;
1580 DWORD unsupported_flags;
1581 DWORD fill_colour = 0;
1582 HRESULT hr = DD_OK;
1583 DDBLTFX rop_fx;
1584
1585 TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n",
1586 iface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx);
1587
1588 unsupported_flags = DDBLT_ALPHADEST
1602 if (flags & unsupported_flags)
1603 {
1604 WARN("Ignoring unsupported flags %#x.\n", flags & unsupported_flags);
1605 flags &= ~unsupported_flags;
1606 }
1607
1608 if ((flags & DDBLT_KEYSRCOVERRIDE) && (!fx || flags & DDBLT_KEYSRC))
1609 {
1610 WARN("Invalid source color key parameters, returning DDERR_INVALIDPARAMS\n");
1611 return DDERR_INVALIDPARAMS;
1612 }
1613
1615 {
1616 WARN("Invalid destination color key parameters, returning DDERR_INVALIDPARAMS\n");
1617 return DDERR_INVALIDPARAMS;
1618 }
1619
1620 if (flags & DDBLT_DDROPS)
1621 {
1622 FIXME("DDBLT_DDROPS not implemented.\n");
1623 if (fx)
1624 FIXME(" rop %#x, pattern %p.\n", fx->dwDDROP, fx->u5.lpDDSPattern);
1625 return DDERR_NORASTEROPHW;
1626 }
1627
1629
1631 {
1632 if (flags & DDBLT_ROP)
1633 {
1635 WARN("DDBLT_ROP used with DDBLT_COLORFILL or DDBLT_DEPTHFILL, returning DDERR_INVALIDPARAMS.\n");
1636 return DDERR_INVALIDPARAMS;
1637 }
1638 if (src_impl)
1639 {
1641 WARN("Depth or colorfill is not compatible with source surfaces, returning DDERR_INVALIDPARAMS\n");
1642 return DDERR_INVALIDPARAMS;
1643 }
1644 if (!fx)
1645 {
1647 WARN("Depth or colorfill used with NULL fx, returning DDERR_INVALIDPARAMS.\n");
1648 return DDERR_INVALIDPARAMS;
1649 }
1650
1652 flags &= ~DDBLT_DEPTHFILL;
1653
1655 {
1657 WARN("DDBLT_COLORFILL used on a depth buffer, returning DDERR_INVALIDPARAMS.\n");
1658 return DDERR_INVALIDPARAMS;
1659 }
1661 {
1663 WARN("DDBLT_DEPTHFILL used on a color buffer, returning DDERR_INVALIDPARAMS.\n");
1664 return DDERR_INVALIDPARAMS;
1665 }
1666 }
1667
1668 if (flags & DDBLT_ROP)
1669 {
1670 if (!fx)
1671 {
1673 WARN("DDBLT_ROP used with NULL fx, returning DDERR_INVALIDPARAMS.\n");
1674 return DDERR_INVALIDPARAMS;
1675 }
1676
1677 if (src_impl && src_rect
1678 && ((ULONG)src_rect->left >= src_rect->right || src_rect->right > src_impl->surface_desc.dwWidth
1679 || (ULONG)src_rect->top >= src_rect->bottom || src_rect->bottom > src_impl->surface_desc.dwHeight))
1680 {
1681 WARN("Invalid source rectangle.\n");
1682 return DDERR_INVALIDRECT;
1683 }
1684
1685 flags &= ~DDBLT_ROP;
1686 switch (fx->dwROP)
1687 {
1688 case SRCCOPY:
1689 break;
1690
1691 case WHITENESS:
1692 case BLACKNESS:
1693 rop_fx = *fx;
1694
1695 if (fx->dwROP == WHITENESS)
1696 rop_fx.u5.dwFillColor = 0xffffffff;
1697 else
1698 rop_fx.u5.dwFillColor = 0;
1699
1702 else
1704
1705 fx = &rop_fx;
1706 break;
1707
1708 default:
1710 WARN("Unsupported ROP %#x used, returning DDERR_NORASTEROPHW.\n", fx->dwROP);
1711 return DDERR_NORASTEROPHW;
1712 }
1713 }
1714
1715 if (!(flags & (DDBLT_COLORFILL | DDBLT_DEPTHFILL)) && !src_impl)
1716 {
1717 WARN("No source surface.\n");
1718 return DDERR_INVALIDPARAMS;
1719 }
1720
1721 if (flags & DDBLT_KEYSRC && (!src_impl || !(src_impl->surface_desc.dwFlags & DDSD_CKSRCBLT)))
1722 {
1723 WARN("DDBLT_KEYSRC blit without color key in surface, returning DDERR_INVALIDPARAMS\n");
1725 return DDERR_INVALIDPARAMS;
1726 }
1727 if (flags & DDBLT_KEYDEST && !(dst_impl->surface_desc.dwFlags & DDSD_CKDESTBLT))
1728 {
1729 WARN("DDBLT_KEYDEST blit without color key in surface, returning DDERR_INVALIDPARAMS\n");
1731 return DDERR_INVALIDPARAMS;
1732 }
1733
1734 if (fx)
1735 {
1736 wined3d_fx.fx = fx->dwDDFX;
1737 fill_colour = fx->u5.dwFillColor;
1738 wined3d_fx.dst_color_key.color_space_low_value = fx->ddckDestColorkey.dwColorSpaceLowValue;
1739 wined3d_fx.dst_color_key.color_space_high_value = fx->ddckDestColorkey.dwColorSpaceHighValue;
1740 wined3d_fx.src_color_key.color_space_low_value = fx->ddckSrcColorkey.dwColorSpaceLowValue;
1741 wined3d_fx.src_color_key.color_space_high_value = fx->ddckSrcColorkey.dwColorSpaceHighValue;
1742 }
1743
1744 hr = ddraw_surface_blt_clipped(dst_impl, dst_rect, src_impl,
1745 src_rect, flags, fill_colour, fx ? &wined3d_fx : NULL, WINED3D_TEXF_LINEAR);
1746
1748 switch(hr)
1749 {
1751 default: return hr;
1752 }
1753}
static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, const RECT *dst_rect_in, struct ddraw_surface *src_surface, const RECT *src_rect_in, DWORD flags, DWORD fill_colour, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: surface.c:1451
#define DDBLT_COLORFILL
Definition: ddraw.h:555
#define DDBLT_ZBUFFERDESTOVERRIDE
Definition: ddraw.h:566
#define DDERR_INVALIDRECT
Definition: ddraw.h:81
#define DDBLT_KEYDESTOVERRIDE
Definition: ddraw.h:559
#define DDBLT_ZBUFFERDESTCONSTOVERRIDE
Definition: ddraw.h:565
#define DDBLT_ALPHAEDGEBLEND
Definition: ddraw.h:549
#define DDBLT_ALPHASRC
Definition: ddraw.h:550
#define DDBLT_ZBUFFERSRCCONSTOVERRIDE
Definition: ddraw.h:567
#define DDBLT_ALPHADESTSURFACEOVERRIDE
Definition: ddraw.h:548
#define DDBLT_ROP
Definition: ddraw.h:562
#define DDBLT_ZBUFFERSRCOVERRIDE
Definition: ddraw.h:568
#define DDBLT_ALPHADEST
Definition: ddraw.h:545
#define DDBLT_ALPHASRCNEG
Definition: ddraw.h:552
#define DDBLT_KEYSRC
Definition: ddraw.h:560
#define DDBLT_ZBUFFER
Definition: ddraw.h:564
#define DDBLT_DDROPS
Definition: ddraw.h:557
#define DDBLT_KEYSRCOVERRIDE
Definition: ddraw.h:561
#define DDBLT_ALPHADESTNEG
Definition: ddraw.h:547
#define DDSD_CKDESTBLT
Definition: ddraw.h:218
#define DDERR_NORASTEROPHW
Definition: ddraw.h:100
#define DDBLT_ALPHADESTCONSTOVERRIDE
Definition: ddraw.h:546
#define DDBLT_ALPHASRCCONSTOVERRIDE
Definition: ddraw.h:551
#define DDBLT_KEYDEST
Definition: ddraw.h:558
#define DDBLT_DEPTHFILL
Definition: ddraw.h:570
#define DDBLT_ALPHASRCSURFACEOVERRIDE
Definition: ddraw.h:553
DWORD dwFillColor
Definition: ddraw.h:1310
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define WINED3DERR_NOTAVAILABLE
Definition: wined3d.h:46
#define BLACKNESS
Definition: wingdi.h:323
#define WHITENESS
Definition: wingdi.h:337
#define SRCCOPY
Definition: wingdi.h:333

Referenced by ddraw_surface1_Blt(), ddraw_surface2_Blt(), ddraw_surface3_Blt(), and ddraw_surface4_Blt().

◆ ddraw_surface7_BltBatch()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_BltBatch ( IDirectDrawSurface7 iface,
DDBLTBATCH Batch,
DWORD  Count,
DWORD  Flags 
)
static

Definition at line 2772 of file surface.c.

2773{
2774 TRACE("iface %p, batch %p, count %u, flags %#x.\n", iface, Batch, Count, Flags);
2775
2776 /* MSDN: "not currently implemented" */
2777 return DDERR_UNSUPPORTED;
2778}
int Count
Definition: noreturn.cpp:7
@ Batch
Definition: ntsecapi.h:291
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by ddraw_surface1_BltBatch(), ddraw_surface2_BltBatch(), ddraw_surface3_BltBatch(), and ddraw_surface4_BltBatch().

◆ ddraw_surface7_BltFast()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_BltFast ( IDirectDrawSurface7 iface,
DWORD  dst_x,
DWORD  dst_y,
IDirectDrawSurface7 src_surface,
RECT src_rect,
DWORD  trans 
)
static

Definition at line 4244 of file surface.c.

4246{
4247 struct ddraw_surface *dst_impl = impl_from_IDirectDrawSurface7(iface);
4248 struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface7(src_surface);
4250 DWORD src_w, src_h, dst_w, dst_h;
4251 HRESULT hr = DD_OK;
4252 RECT dst_rect, s;
4253
4254 TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n",
4255 iface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), trans);
4256
4257 dst_w = dst_impl->surface_desc.dwWidth;
4258 dst_h = dst_impl->surface_desc.dwHeight;
4259
4260 if (!src_rect)
4261 {
4262 SetRect(&s, 0, 0, src_impl->surface_desc.dwWidth, src_impl->surface_desc.dwHeight);
4263 src_rect = &s;
4264 }
4265
4266 src_w = src_rect->right - src_rect->left;
4267 src_h = src_rect->bottom - src_rect->top;
4268 if (src_w > dst_w || dst_x > dst_w - src_w
4269 || src_h > dst_h || dst_y > dst_h - src_h)
4270 {
4271 WARN("Destination area out of bounds, returning DDERR_INVALIDRECT.\n");
4272 return DDERR_INVALIDRECT;
4273 }
4274
4275 SetRect(&dst_rect, dst_x, dst_y, dst_x + src_w, dst_y + src_h);
4276 if (trans & DDBLTFAST_SRCCOLORKEY)
4278 if (trans & DDBLTFAST_DESTCOLORKEY)
4280 if (trans & DDBLTFAST_WAIT)
4282 if (trans & DDBLTFAST_DONOTWAIT)
4284
4286 if (dst_impl->clipper)
4287 {
4289 WARN("Destination surface has a clipper set, returning DDERR_BLTFASTCANTCLIP.\n");
4290 return DDERR_BLTFASTCANTCLIP;
4291 }
4292
4294 hr = ddraw_surface_update_frontbuffer(src_impl, src_rect, TRUE);
4295 if (SUCCEEDED(hr))
4296 hr = wined3d_texture_blt(dst_impl->wined3d_texture, dst_impl->sub_resource_idx, &dst_rect,
4297 src_impl->wined3d_texture, src_impl->sub_resource_idx, src_rect, flags, NULL, WINED3D_TEXF_POINT);
4299 hr = ddraw_surface_update_frontbuffer(dst_impl, &dst_rect, FALSE);
4301
4302 switch(hr)
4303 {
4305 default: return hr;
4306 }
4307}
HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface, const RECT *rect, BOOL read)
Definition: surface.c:43
GLdouble s
Definition: gl.h:2039
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define DDBLTFAST_WAIT
Definition: ddraw.h:580
#define DDBLTFAST_SRCCOLORKEY
Definition: ddraw.h:578
#define DDBLTFAST_DESTCOLORKEY
Definition: ddraw.h:579
#define DDBLTFAST_DONOTWAIT
Definition: ddraw.h:581
#define DDERR_BLTFASTCANTCLIP
Definition: ddraw.h:148
#define WINED3D_BLT_DST_CKEY
Definition: wined3d.h:1360
#define WINED3D_BLT_SRC_CKEY
Definition: wined3d.h:1362
@ WINED3D_TEXF_POINT
Definition: wined3d.h:686
#define WINED3D_BLT_SYNCHRONOUS
Definition: wined3d.h:1367
#define WINED3D_BLT_DO_NOT_WAIT
Definition: wined3d.h:1365
#define WINED3D_BLT_WAIT
Definition: wined3d.h:1364

Referenced by ddraw_surface1_BltFast(), ddraw_surface2_BltFast(), ddraw_surface3_BltFast(), and ddraw_surface4_BltFast().

◆ ddraw_surface7_ChangeUniquenessValue()

static HRESULT WINAPI ddraw_surface7_ChangeUniquenessValue ( IDirectDrawSurface7 iface)
static

Definition at line 4125 of file surface.c.

4126{
4127 TRACE("iface %p.\n", iface);
4128
4129 return DD_OK;
4130}

Referenced by ddraw_surface4_ChangeUniquenessValue().

◆ ddraw_surface7_DeleteAttachedSurface()

static HRESULT WINAPI ddraw_surface7_DeleteAttachedSurface ( IDirectDrawSurface7 iface,
DWORD  flags,
IDirectDrawSurface7 attachment 
)
static

Definition at line 2085 of file surface.c.

2087{
2088 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
2090
2091 TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment);
2092
2093 return ddraw_surface_delete_attached_surface(surface, attachment_impl, (IUnknown *)attachment);
2094}

◆ ddraw_surface7_EnumAttachedSurfaces()

static HRESULT WINAPI ddraw_surface7_EnumAttachedSurfaces ( IDirectDrawSurface7 iface,
void context,
LPDDENUMSURFACESCALLBACK7  cb 
)
static

Definition at line 2830 of file surface.c.

2832{
2833 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
2834 struct ddraw_surface *surf;
2836 int i;
2837
2838 /* Attached surfaces aren't handled in WineD3D */
2839 TRACE("iface %p, context %p, callback %p.\n", iface, context, cb);
2840
2841 if(!cb)
2842 return DDERR_INVALIDPARAMS;
2843
2845
2846 for(i = 0; i < MAX_COMPLEX_ATTACHED; i++)
2847 {
2848 surf = surface->complex_array[i];
2849 if(!surf) break;
2850
2852 desc = surf->surface_desc;
2853 /* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */
2855 {
2857 return DD_OK;
2858 }
2859 }
2860
2861 for (surf = surface->next_attached; surf != NULL; surf = surf->next_attached)
2862 {
2864 desc = surf->surface_desc;
2865 /* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */
2867 {
2869 return DD_OK;
2870 }
2871 }
2872
2873 TRACE(" end of enumeration.\n");
2874
2876
2877 return DD_OK;
2878}
#define MAX_COMPLEX_ATTACHED
static ULONG WINAPI ddraw_surface7_AddRef(IDirectDrawSurface7 *iface)
Definition: surface.c:341
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const WCHAR desc[]
Definition: protectdata.c:36
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
#define DDENUMRET_CANCEL
Definition: ddraw.h:188
struct ddraw_surface * next_attached
struct ddraw_surface * complex_array[MAX_COMPLEX_ATTACHED]

Referenced by ddraw_surface1_EnumAttachedSurfaces(), ddraw_surface2_EnumAttachedSurfaces(), ddraw_surface3_EnumAttachedSurfaces(), and ddraw_surface4_EnumAttachedSurfaces().

◆ ddraw_surface7_EnumOverlayZOrders()

static HRESULT WINAPI ddraw_surface7_EnumOverlayZOrders ( IDirectDrawSurface7 iface,
DWORD  Flags,
void context,
LPDDENUMSURFACESCALLBACK7  cb 
)
static

Definition at line 2990 of file surface.c.

2992{
2993 FIXME("iface %p, flags %#x, context %p, callback %p stub!\n", iface, Flags, context, cb);
2994
2995 return DD_OK;
2996}

Referenced by ddraw_surface1_EnumOverlayZOrders(), ddraw_surface2_EnumOverlayZOrders(), ddraw_surface3_EnumOverlayZOrders(), and ddraw_surface4_EnumOverlayZOrders().

◆ ddraw_surface7_Flip()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip ( IDirectDrawSurface7 iface,
IDirectDrawSurface7 src,
DWORD  flags 
)
static

Definition at line 1227 of file surface.c.

1229{
1230 struct ddraw_surface *dst_impl = impl_from_IDirectDrawSurface7(iface);
1232 struct wined3d_rendertarget_view *tmp_rtv, *src_rtv, *rtv;
1233 struct ddraw_texture *ddraw_texture, *prev_ddraw_texture;
1234 DDSCAPS2 caps = {DDSCAPS_FLIP, 0, 0, {0}};
1235 struct wined3d_texture *texture;
1237 HRESULT hr;
1238
1239 TRACE("iface %p, src %p, flags %#x.\n", iface, src, flags);
1240
1241 if (src == iface || !(dst_impl->surface_desc.ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER | DDSCAPS_OVERLAY)))
1242 return DDERR_NOTFLIPPABLE;
1243
1244 if (IDirectDrawSurface7_IsLost(iface) == DDERR_SURFACELOST)
1245 return DDERR_SURFACELOST;
1246
1248
1250 && !(dst_impl->ddraw->cooperative_level & DDSCL_EXCLUSIVE))
1251 {
1252 WARN("Not in exclusive mode.\n");
1254 return DDERR_NOEXCLUSIVEMODE;
1255 }
1256
1257 tmp_rtv = ddraw_surface_get_rendertarget_view(dst_impl);
1258 if (dst_impl->sub_resource_idx)
1259 ERR("Invalid sub-resource index %u on surface %p.\n", dst_impl->sub_resource_idx, dst_impl);
1260 texture = dst_impl->wined3d_texture;
1261 rtv = wined3d_device_get_rendertarget_view(dst_impl->ddraw->wined3d_device, 0);
1263
1264 if (src_impl)
1265 {
1266 for (current = iface; current != src;)
1267 {
1269 {
1270 WARN("Surface %p is not on the same flip chain as surface %p.\n", src, iface);
1272 return DDERR_NOTFLIPPABLE;
1273 }
1275 if (current == iface)
1276 {
1277 WARN("Surface %p is not on the same flip chain as surface %p.\n", src, iface);
1279 return DDERR_NOTFLIPPABLE;
1280 }
1281 }
1282
1283 src_rtv = ddraw_surface_get_rendertarget_view(src_impl);
1284 if (rtv == dst_impl->wined3d_rtv)
1285 wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE);
1286 wined3d_rendertarget_view_set_parent(src_rtv, dst_impl);
1287 dst_impl->wined3d_rtv = src_rtv;
1289 prev_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture);
1291 if (src_impl->sub_resource_idx)
1292 ERR("Invalid sub-resource index %u on surface %p.\n", src_impl->sub_resource_idx, src_impl);
1293 dst_impl->wined3d_texture = src_impl->wined3d_texture;
1294 ddraw_texture = prev_ddraw_texture;
1295 }
1296 else
1297 {
1298 for (current = iface;;)
1299 {
1301 {
1302 ERR("Can't find a flip target\n");
1304 return DDERR_NOTFLIPPABLE; /* Unchecked */
1305 }
1307 if (current == iface)
1308 {
1309 dst_impl = impl_from_IDirectDrawSurface7(iface);
1310 break;
1311 }
1312
1314 src_rtv = ddraw_surface_get_rendertarget_view(src_impl);
1315 if (rtv == dst_impl->wined3d_rtv)
1316 wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE);
1317 wined3d_rendertarget_view_set_parent(src_rtv, dst_impl);
1318 dst_impl->wined3d_rtv = src_rtv;
1320 prev_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture);
1322 ddraw_texture = prev_ddraw_texture;
1323 if (src_impl->sub_resource_idx)
1324 ERR("Invalid sub-resource index %u on surface %p.\n", src_impl->sub_resource_idx, src_impl);
1325 dst_impl->wined3d_texture = src_impl->wined3d_texture;
1326 dst_impl = src_impl;
1327 }
1328 }
1329
1330 /* We don't have to worry about potential texture bindings, since
1331 * flippable surfaces can never be textures. */
1332 if (rtv == src_impl->wined3d_rtv)
1333 wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, tmp_rtv, FALSE);
1334 wined3d_rendertarget_view_set_parent(tmp_rtv, src_impl);
1335 src_impl->wined3d_rtv = tmp_rtv;
1338 src_impl->wined3d_texture = texture;
1339
1340 if (flags)
1341 {
1342 static UINT once;
1343 if (!once++)
1344 FIXME("Ignoring flags %#x.\n", flags);
1345 else
1346 WARN("Ignoring flags %#x.\n", flags);
1347 }
1348
1351 else
1352 hr = DD_OK;
1353
1355
1356 return hr;
1357}
struct wined3d_rendertarget_view * ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface)
Definition: surface.c:6520
HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device, unsigned int view_idx, struct wined3d_rendertarget_view *view, BOOL set_viewport)
Definition: device.c:4468
struct wined3d_rendertarget_view *CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, unsigned int view_idx)
Definition: device.c:4447
void CDECL wined3d_resource_set_parent(struct wined3d_resource *resource, void *parent)
Definition: resource.c:290
void *CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture)
Definition: texture.c:1121
void CDECL wined3d_texture_set_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx, void *parent)
Definition: texture.c:3464
struct wined3d_resource *CDECL wined3d_texture_get_resource(struct wined3d_texture *texture)
Definition: texture.c:1052
void CDECL wined3d_rendertarget_view_set_parent(struct wined3d_rendertarget_view *view, void *parent)
Definition: view.c:390
GLenum GLuint texture
Definition: glext.h:6295
struct task_struct * current
Definition: linux.c:32
unsigned int UINT
Definition: ndis.h:50
#define DDSCAPS_FRONTBUFFER
Definition: ddraw.h:254
#define DDSCAPS_OVERLAY
Definition: ddraw.h:256
#define DDERR_NOTFLIPPABLE
Definition: ddraw.h:156
#define DDSCL_EXCLUSIVE
Definition: ddraw.h:536
#define DDERR_NOEXCLUSIVEMODE
Definition: ddraw.h:93
#define DDSCAPS_FLIP
Definition: ddraw.h:253
struct wined3d_rendertarget_view * wined3d_rtv

Referenced by ddraw_surface1_Flip(), ddraw_surface2_Flip(), ddraw_surface3_Flip(), and ddraw_surface4_Flip().

◆ ddraw_surface7_FreePrivateData()

static HRESULT WINAPI ddraw_surface7_FreePrivateData ( IDirectDrawSurface7 iface,
REFGUID  tag 
)
static

Definition at line 2637 of file surface.c.

2638{
2639 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
2641
2642 TRACE("iface %p, tag %s.\n", iface, debugstr_guid(tag));
2643
2646 if (!entry)
2647 {
2649 return DDERR_NOTFOUND;
2650 }
2651
2654
2655 return DD_OK;
2656}
uint32_t entry
Definition: isohybrid.c:63
struct wined3d_private_store private_store
static struct wined3d_private_data * wined3d_private_store_get_private_data(const struct wined3d_private_store *store, const GUID *tag)
Definition: wined3d.h:2517
static void wined3d_private_store_free_private_data(struct wined3d_private_store *store, struct wined3d_private_data *entry)
Definition: wined3d.h:2532

Referenced by ddraw_surface4_FreePrivateData().

◆ ddraw_surface7_GetAttachedSurface()

static HRESULT WINAPI ddraw_surface7_GetAttachedSurface ( IDirectDrawSurface7 iface,
DDSCAPS2 Caps,
IDirectDrawSurface7 **  Surface 
)
static

Definition at line 736 of file surface.c.

738{
740 struct ddraw_surface *surf;
741 DDSCAPS2 our_caps;
742 int i;
743
744 TRACE("iface %p, caps %p, attachment %p.\n", iface, Caps, Surface);
745
747
748 if(This->version < 7)
749 {
750 /* Earlier dx apps put garbage into these members, clear them */
751 our_caps.dwCaps = Caps->dwCaps;
752 our_caps.dwCaps2 = 0;
753 our_caps.dwCaps3 = 0;
754 our_caps.u1.dwCaps4 = 0;
755 }
756 else
757 {
758 our_caps = *Caps;
759 }
760
761 TRACE("(%p): Looking for caps: %x,%x,%x,%x\n", This, our_caps.dwCaps, our_caps.dwCaps2, our_caps.dwCaps3, our_caps.u1.dwCaps4); /* FIXME: Better debugging */
762
763 for(i = 0; i < MAX_COMPLEX_ATTACHED; i++)
764 {
765 surf = This->complex_array[i];
766 if(!surf) break;
767
768 TRACE("Surface: (%p) caps: %#x, %#x, %#x, %#x.\n", surf,
772 surf->surface_desc.ddsCaps.u1.dwCaps4);
773
774 if (((surf->surface_desc.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) &&
775 ((surf->surface_desc.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2)) {
776
777 /* MSDN: "This method fails if more than one surface is attached
778 * that matches the capabilities requested."
779 *
780 * Not sure how to test this.
781 */
782
783 TRACE("(%p): Returning surface %p\n", This, surf);
784 *Surface = &surf->IDirectDrawSurface7_iface;
785 ddraw_surface7_AddRef(*Surface);
787
788 return DD_OK;
789 }
790 }
791
792 /* Next, look at the attachment chain */
793 surf = This;
794
795 while( (surf = surf->next_attached) )
796 {
797 TRACE("Surface: (%p) caps: %#x, %#x, %#x, %#x.\n", surf,
801 surf->surface_desc.ddsCaps.u1.dwCaps4);
802
803 if (((surf->surface_desc.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) &&
804 ((surf->surface_desc.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2)) {
805
806 TRACE("(%p): Returning surface %p\n", This, surf);
807 *Surface = &surf->IDirectDrawSurface7_iface;
808 ddraw_surface7_AddRef(*Surface);
810 return DD_OK;
811 }
812 }
813
814 TRACE("(%p) Didn't find a valid surface\n", This);
815
817
818 *Surface = NULL;
819 return DDERR_NOTFOUND;
820}

Referenced by ddraw_surface1_GetAttachedSurface(), ddraw_surface2_GetAttachedSurface(), ddraw_surface3_GetAttachedSurface(), ddraw_surface4_GetAttachedSurface(), ddraw_surface7_Flip(), and get_sub_mimaplevel().

◆ ddraw_surface7_GetBltStatus()

static HRESULT WINAPI ddraw_surface7_GetBltStatus ( IDirectDrawSurface7 iface,
DWORD  Flags 
)
static

Definition at line 3067 of file surface.c.

3068{
3069 TRACE("iface %p, flags %#x.\n", iface, Flags);
3070
3071 switch (Flags)
3072 {
3073 case WINEDDGBS_CANBLT:
3075 return DD_OK;
3076
3077 default:
3078 return DDERR_INVALIDPARAMS;
3079 }
3080}
#define WINEDDGBS_ISBLTDONE
Definition: wined3d.h:1373
#define WINEDDGBS_CANBLT
Definition: wined3d.h:1372

Referenced by ddraw_surface1_GetBltStatus(), ddraw_surface2_GetBltStatus(), ddraw_surface3_GetBltStatus(), and ddraw_surface4_GetBltStatus().

◆ ddraw_surface7_GetCaps()

static HRESULT WINAPI ddraw_surface7_GetCaps ( IDirectDrawSurface7 iface,
DDSCAPS2 Caps 
)
static

Definition at line 2383 of file surface.c.

2384{
2385 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
2386
2387 TRACE("iface %p, caps %p.\n", iface, Caps);
2388
2389 if(!Caps)
2390 return DDERR_INVALIDPARAMS;
2391
2392 *Caps = surface->surface_desc.ddsCaps;
2393
2394 return DD_OK;
2395}

Referenced by ddraw_surface1_GetCaps(), ddraw_surface2_GetCaps(), ddraw_surface3_GetCaps(), and ddraw_surface4_GetCaps().

◆ ddraw_surface7_GetClipper()

static HRESULT WINAPI ddraw_surface7_GetClipper ( IDirectDrawSurface7 iface,
IDirectDrawClipper **  Clipper 
)
static

Definition at line 4376 of file surface.c.

4377{
4378 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
4379
4380 TRACE("iface %p, clipper %p.\n", iface, Clipper);
4381
4382 if (!Clipper)
4383 return DDERR_INVALIDPARAMS;
4384
4386 if (!surface->clipper)
4387 {
4390 }
4391
4392 *Clipper = &surface->clipper->IDirectDrawClipper_iface;
4393 IDirectDrawClipper_AddRef(*Clipper);
4395
4396 return DD_OK;
4397}
#define DDERR_NOCLIPPERATTACHED
Definition: ddraw.h:142

Referenced by ddraw_surface1_GetClipper(), ddraw_surface2_GetClipper(), ddraw_surface3_GetClipper(), and ddraw_surface4_GetClipper().

◆ ddraw_surface7_GetColorKey()

static HRESULT WINAPI ddraw_surface7_GetColorKey ( IDirectDrawSurface7 iface,
DWORD  Flags,
DDCOLORKEY CKey 
)
static

Definition at line 3132 of file surface.c.

3133{
3135
3136 TRACE("iface %p, flags %#x, color_key %p.\n", iface, Flags, CKey);
3137
3138 if(!CKey)
3139 return DDERR_INVALIDPARAMS;
3140
3142
3143 switch (Flags)
3144 {
3145 case DDCKEY_DESTBLT:
3146 if (!(This->surface_desc.dwFlags & DDSD_CKDESTBLT))
3147 {
3149 return DDERR_NOCOLORKEY;
3150 }
3151 *CKey = This->surface_desc.ddckCKDestBlt;
3152 break;
3153
3154 case DDCKEY_DESTOVERLAY:
3155 if (!(This->surface_desc.dwFlags & DDSD_CKDESTOVERLAY))
3156 {
3158 return DDERR_NOCOLORKEY;
3159 }
3160 *CKey = This->surface_desc.u3.ddckCKDestOverlay;
3161 break;
3162
3163 case DDCKEY_SRCBLT:
3164 if (!(This->surface_desc.dwFlags & DDSD_CKSRCBLT))
3165 {
3167 return DDERR_NOCOLORKEY;
3168 }
3169 *CKey = This->surface_desc.ddckCKSrcBlt;
3170 break;
3171
3172 case DDCKEY_SRCOVERLAY:
3173 if (!(This->surface_desc.dwFlags & DDSD_CKSRCOVERLAY))
3174 {
3176 return DDERR_NOCOLORKEY;
3177 }
3178 *CKey = This->surface_desc.ddckCKSrcOverlay;
3179 break;
3180
3181 default:
3183 return DDERR_INVALIDPARAMS;
3184 }
3185
3187
3188 return DD_OK;
3189}
#define DDSD_CKDESTOVERLAY
Definition: ddraw.h:217
#define DDCKEY_SRCOVERLAY
Definition: ddraw.h:479
#define DDCKEY_DESTOVERLAY
Definition: ddraw.h:477
#define DDCKEY_DESTBLT
Definition: ddraw.h:476
#define DDERR_NOCOLORKEY
Definition: ddraw.h:90
#define DDSD_CKSRCOVERLAY
Definition: ddraw.h:219

Referenced by ddraw_surface1_GetColorKey(), ddraw_surface2_GetColorKey(), ddraw_surface3_GetColorKey(), and ddraw_surface4_GetColorKey().

◆ ddraw_surface7_GetDC()

static HRESULT WINAPI ddraw_surface7_GetDC ( IDirectDrawSurface7 iface,
HDC dc 
)
static

Definition at line 2208 of file surface.c.

2209{
2210 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
2211 HRESULT hr = DD_OK;
2212
2213 TRACE("iface %p, dc %p.\n", iface, dc);
2214
2215 if (!dc)
2216 return DDERR_INVALIDPARAMS;
2217
2219 if (surface->dc)
2223 if (SUCCEEDED(hr))
2225
2226 if (SUCCEEDED(hr))
2227 {
2228 surface->dc = *dc;
2229
2231 {
2232 const struct ddraw_palette *palette;
2233
2234 if (surface->palette)
2235 palette = surface->palette;
2236 else if (surface->ddraw->primary)
2237 palette = surface->ddraw->primary->palette;
2238 else
2239 palette = NULL;
2240
2241 if (palette)
2242 wined3d_palette_apply_to_dc(palette->wined3d_palette, *dc);
2243 }
2244 }
2245
2247 switch (hr)
2248 {
2249 /* Some, but not all errors set *dc to NULL. E.g. DCALREADYCREATED
2250 * does not touch *dc. */
2252 *dc = NULL;
2253 return DDERR_CANTCREATEDC;
2254
2255 default:
2256 return hr;
2257 }
2258}
static BOOL format_is_paletteindexed(const DDPIXELFORMAT *fmt)
void CDECL wined3d_palette_apply_to_dc(const struct wined3d_palette *palette, HDC dc)
Definition: palette.c:86
HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc)
Definition: texture.c:3623
#define DDERR_CANTCREATEDC
Definition: ddraw.h:159
#define DDERR_DCALREADYCREATED
Definition: ddraw.h:171
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48

Referenced by ddraw_surface1_GetDC(), ddraw_surface2_GetDC(), ddraw_surface3_GetDC(), and ddraw_surface4_GetDC().

◆ ddraw_surface7_GetDDInterface()

static HRESULT WINAPI ddraw_surface7_GetDDInterface ( IDirectDrawSurface7 iface,
void **  DD 
)
static

Definition at line 4065 of file surface.c.

4066{
4068
4069 TRACE("iface %p, ddraw %p.\n", iface, DD);
4070
4071 if(!DD)
4072 return DDERR_INVALIDPARAMS;
4073
4074 switch(This->version)
4075 {
4076 case 7:
4077 *DD = &This->ddraw->IDirectDraw7_iface;
4078 break;
4079
4080 case 4:
4081 *DD = &This->ddraw->IDirectDraw4_iface;
4082 break;
4083
4084 case 2:
4085 *DD = &This->ddraw->IDirectDraw2_iface;
4086 break;
4087
4088 case 1:
4089 *DD = &This->ddraw->IDirectDraw_iface;
4090 break;
4091
4092 }
4093 IUnknown_AddRef((IUnknown *)*DD);
4094
4095 return DD_OK;
4096}
#define DD(x)

Referenced by ddraw_surface2_GetDDInterface(), ddraw_surface3_GetDDInterface(), and ddraw_surface4_GetDDInterface().

◆ ddraw_surface7_GetFlipStatus()

static HRESULT WINAPI ddraw_surface7_GetFlipStatus ( IDirectDrawSurface7 iface,
DWORD  Flags 
)
static

Definition at line 3236 of file surface.c.

3237{
3238 TRACE("iface %p, flags %#x.\n", iface, Flags);
3239
3240 /* XXX: DDERR_INVALIDSURFACETYPE */
3241
3242 switch (Flags)
3243 {
3244 case WINEDDGFS_CANFLIP:
3246 return DD_OK;
3247
3248 default:
3249 return DDERR_INVALIDPARAMS;
3250 }
3251}
#define WINEDDGFS_ISFLIPDONE
Definition: wined3d.h:1377
#define WINEDDGFS_CANFLIP
Definition: wined3d.h:1376

Referenced by ddraw_surface1_GetFlipStatus(), ddraw_surface2_GetFlipStatus(), ddraw_surface3_GetFlipStatus(), and ddraw_surface4_GetFlipStatus().

◆ ddraw_surface7_GetLOD()

static HRESULT WINAPI ddraw_surface7_GetLOD ( IDirectDrawSurface7 iface,
DWORD MaxLOD 
)
static

Definition at line 4206 of file surface.c.

4207{
4208 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
4209
4210 TRACE("iface %p, lod %p.\n", iface, MaxLOD);
4211
4212 if(!MaxLOD)
4213 return DDERR_INVALIDPARAMS;
4214
4217 {
4219 return DDERR_INVALIDOBJECT;
4220 }
4221
4222 *MaxLOD = wined3d_texture_get_lod(surface->wined3d_texture);
4224
4225 return DD_OK;
4226}
DWORD CDECL wined3d_texture_get_lod(const struct wined3d_texture *texture)
Definition: texture.c:1221
#define DDERR_INVALIDOBJECT
Definition: ddraw.h:78
#define DDSCAPS2_TEXTUREMANAGE
Definition: ddraw.h:285

◆ ddraw_surface7_GetOverlayPosition()

static HRESULT WINAPI ddraw_surface7_GetOverlayPosition ( IDirectDrawSurface7 iface,
LONG x,
LONG y 
)
static

Definition at line 3301 of file surface.c.

3302{
3303 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
3304 HRESULT hr;
3305
3306 TRACE("iface %p, x %p, y %p.\n", iface, x, y);
3307
3310 surface->sub_resource_idx, x, y);
3312
3313 return hr;
3314}
HRESULT CDECL wined3d_texture_get_overlay_position(const struct wined3d_texture *texture, unsigned int sub_resource_idx, LONG *x, LONG *y)
Definition: texture.c:3325

Referenced by ddraw_surface1_GetOverlayPosition(), ddraw_surface2_GetOverlayPosition(), ddraw_surface3_GetOverlayPosition(), and ddraw_surface4_GetOverlayPosition().

◆ ddraw_surface7_GetPalette()

static HRESULT WINAPI ddraw_surface7_GetPalette ( IDirectDrawSurface7 iface,
IDirectDrawPalette **  palette 
)
static

Definition at line 4707 of file surface.c.

4708{
4709 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
4710 struct ddraw_palette *palette_impl;
4711 HRESULT hr = DD_OK;
4712
4713 TRACE("iface %p, palette %p.\n", iface, palette);
4714
4715 if (!palette)
4716 return DDERR_INVALIDPARAMS;
4717 if (IDirectDrawSurface7_IsLost(iface) == DDERR_SURFACELOST)
4718 {
4719 WARN("Surface lost, returning DDERR_SURFACELOST.\n");
4720 return DDERR_SURFACELOST;
4721 }
4722
4724 if ((palette_impl = surface->palette))
4725 {
4726 *palette = &palette_impl->IDirectDrawPalette_iface;
4727 IDirectDrawPalette_AddRef(*palette);
4728 }
4729 else
4730 {
4731 *palette = NULL;
4733 }
4735
4736 return hr;
4737}

Referenced by ddraw_surface1_GetPalette(), ddraw_surface2_GetPalette(), ddraw_surface3_GetPalette(), and ddraw_surface4_GetPalette().

◆ ddraw_surface7_GetPixelFormat()

static HRESULT WINAPI ddraw_surface7_GetPixelFormat ( IDirectDrawSurface7 iface,
DDPIXELFORMAT PixelFormat 
)
static

Definition at line 3366 of file surface.c.

3367{
3368 /* What is DDERR_INVALIDSURFACETYPE for here? */
3369 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
3370
3371 TRACE("iface %p, pixel_format %p.\n", iface, PixelFormat);
3372
3373 if(!PixelFormat)
3374 return DDERR_INVALIDPARAMS;
3375
3379
3380 return DD_OK;
3381}
#define DD_STRUCT_COPY_BYSIZE(to, from)
INT PixelFormat

Referenced by ddraw_surface1_GetPixelFormat(), ddraw_surface2_GetPixelFormat(), ddraw_surface3_GetPixelFormat(), and ddraw_surface4_GetPixelFormat().

◆ ddraw_surface7_GetPriority()

static HRESULT WINAPI ddraw_surface7_GetPriority ( IDirectDrawSurface7 iface,
DWORD priority 
)
static

Definition at line 2479 of file surface.c.

2480{
2481 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
2482 const struct wined3d_resource *resource;
2484 HRESULT hr;
2485
2486 TRACE("iface %p, priority %p.\n", iface, priority);
2487
2490 {
2491 WARN("Called on offscreenplain surface, returning DDERR_INVALIDOBJECT.\n");
2493 }
2494 else if (!(surface->surface_desc.ddsCaps.dwCaps2 & managed) || !surface->is_complex_root)
2495 {
2496 WARN("Called on non-managed texture or non-root surface, returning DDERR_INVALIDPARAMS.\n");
2498 }
2499 else
2500 {
2503 hr = DD_OK;
2504 }
2506
2507 return hr;
2508}
DWORD CDECL wined3d_resource_get_priority(const struct wined3d_resource *resource)
Definition: resource.c:279
#define resource
Definition: kernel32.h:9
static int priority
Definition: timer.c:163
#define DDSCAPS2_D3DTEXTUREMANAGE
Definition: ddraw.h:305

◆ ddraw_surface7_GetPrivateData()

static HRESULT WINAPI ddraw_surface7_GetPrivateData ( IDirectDrawSurface7 iface,
REFGUID  tag,
void data,
DWORD size 
)
static

Definition at line 2573 of file surface.c.

2574{
2575 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
2576 const struct wined3d_private_data *stored_data;
2577 HRESULT hr;
2578
2579 TRACE("iface %p, tag %s, data %p, data_size %p.\n",
2580 iface, debugstr_guid(tag), data, size);
2581
2584 if (!stored_data)
2585 {
2587 goto done;
2588 }
2589 if (!size)
2590 {
2592 goto done;
2593 }
2594 if (*size < stored_data->size)
2595 {
2596 *size = stored_data->size;
2598 goto done;
2599 }
2600 if (!data)
2601 {
2603 goto done;
2604 }
2605
2606 *size = stored_data->size;
2607 memcpy(data, stored_data->content.data, stored_data->size);
2608 hr = DD_OK;
2609
2610done:
2612 return hr;
2613}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define DDERR_MOREDATA
Definition: ddraw.h:176
union wined3d_private_data::@3678 content

Referenced by ddraw_surface4_GetPrivateData().

◆ ddraw_surface7_GetSurfaceDesc()

static HRESULT WINAPI ddraw_surface7_GetSurfaceDesc ( IDirectDrawSurface7 iface,
DDSURFACEDESC2 DDSD 
)
static

Definition at line 3433 of file surface.c.

3434{
3435 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
3436
3437 TRACE("iface %p, surface_desc %p.\n", iface, DDSD);
3438
3439 if(!DDSD)
3440 return DDERR_INVALIDPARAMS;
3441
3442 if (DDSD->dwSize != sizeof(DDSURFACEDESC2))
3443 {
3444 WARN("Incorrect struct size %d, returning DDERR_INVALIDPARAMS\n",DDSD->dwSize);
3445 return DDERR_INVALIDPARAMS;
3446 }
3447
3449 DD_STRUCT_COPY_BYSIZE(DDSD, &surface->surface_desc);
3450 TRACE("Returning surface desc:\n");
3453
3454 return DD_OK;
3455}

Referenced by ddraw_surface4_GetSurfaceDesc().

◆ ddraw_surface7_GetUniquenessValue()

static HRESULT WINAPI ddraw_surface7_GetUniquenessValue ( IDirectDrawSurface7 iface,
DWORD pValue 
)
static

Definition at line 4141 of file surface.c.

4142{
4143 TRACE("iface %p, value %p.\n", iface, pValue);
4144
4145 *pValue = 0;
4146
4147 return DD_OK;
4148}

Referenced by ddraw_surface4_GetUniquenessValue().

◆ ddraw_surface7_Initialize()

static HRESULT WINAPI ddraw_surface7_Initialize ( IDirectDrawSurface7 iface,
IDirectDraw *  ddraw,
DDSURFACEDESC2 surface_desc 
)
static

Definition at line 3524 of file surface.c.

3526{
3527 TRACE("iface %p, ddraw %p, surface_desc %p.\n", iface, ddraw, surface_desc);
3528
3530}
#define DDERR_ALREADYINITIALIZED
Definition: ddraw.h:67

Referenced by ddraw_surface1_Initialize(), ddraw_surface2_Initialize(), ddraw_surface3_Initialize(), and ddraw_surface4_Initialize().

◆ ddraw_surface7_IsLost()

static HRESULT WINAPI ddraw_surface7_IsLost ( IDirectDrawSurface7 iface)
static

Definition at line 3612 of file surface.c.

3613{
3614 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
3615
3616 TRACE("iface %p.\n", iface);
3617
3618 if (surface->ddraw->device_state != DDRAW_DEVICE_STATE_OK || surface->is_lost)
3619 return DDERR_SURFACELOST;
3620
3621 return DD_OK;
3622}
@ DDRAW_DEVICE_STATE_OK
Definition: ddraw_private.h:71

Referenced by ddraw_surface1_IsLost(), ddraw_surface2_IsLost(), ddraw_surface3_IsLost(), and ddraw_surface4_IsLost().

◆ ddraw_surface7_Lock()

static HRESULT WINAPI ddraw_surface7_Lock ( IDirectDrawSurface7 iface,
RECT rect,
DDSURFACEDESC2 surface_desc,
DWORD  flags,
HANDLE  h 
)
static

Definition at line 1064 of file surface.c.

1066{
1067 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
1068 unsigned int surface_desc_size;
1069
1070 TRACE("iface %p, rect %s, surface_desc %p, flags %#x, h %p.\n",
1072
1073 if (!surface_validate_lock_desc(surface, (DDSURFACEDESC *)surface_desc, &surface_desc_size))
1074 return DDERR_INVALIDPARAMS;
1075
1076 return surface_lock(surface, rect, surface_desc, surface_desc_size, flags, h);
1077}

◆ ddraw_surface7_PageLock()

static HRESULT WINAPI ddraw_surface7_PageLock ( IDirectDrawSurface7 iface,
DWORD  Flags 
)
static

Definition at line 2679 of file surface.c.

2680{
2681 TRACE("iface %p, flags %#x.\n", iface, Flags);
2682
2683 /* This is Windows memory management related - we don't need this */
2684 return DD_OK;
2685}

Referenced by ddraw_surface2_PageLock(), ddraw_surface3_PageLock(), and ddraw_surface4_PageLock().

◆ ddraw_surface7_PageUnlock()

static HRESULT WINAPI ddraw_surface7_PageUnlock ( IDirectDrawSurface7 iface,
DWORD  Flags 
)
static

Definition at line 2726 of file surface.c.

2727{
2728 TRACE("iface %p, flags %#x.\n", iface, Flags);
2729
2730 return DD_OK;
2731}

Referenced by ddraw_surface2_PageUnlock(), ddraw_surface3_PageUnlock(), and ddraw_surface4_PageUnlock().

◆ ddraw_surface7_QueryInterface()

static HRESULT WINAPI ddraw_surface7_QueryInterface ( IDirectDrawSurface7 iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 133 of file surface.c.

134{
136
137 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj);
138
139 /* According to COM docs, if the QueryInterface fails, obj should be set to NULL */
140 *obj = NULL;
141
142 if(!riid)
143 return DDERR_INVALIDPARAMS;
144
145 if (IsEqualGUID(riid, &IID_IDirectDrawSurface7))
146 {
147 IDirectDrawSurface7_AddRef(iface);
148 *obj = iface;
149 TRACE("(%p) returning IDirectDrawSurface7 interface at %p\n", This, *obj);
150 return S_OK;
151 }
152
153 if (IsEqualGUID(riid, &IID_IDirectDrawSurface4))
154 {
155 IDirectDrawSurface4_AddRef(&This->IDirectDrawSurface4_iface);
156 *obj = &This->IDirectDrawSurface4_iface;
157 TRACE("(%p) returning IDirectDrawSurface4 interface at %p\n", This, *obj);
158 return S_OK;
159 }
160
161 if (IsEqualGUID(riid, &IID_IDirectDrawSurface3))
162 {
163 IDirectDrawSurface3_AddRef(&This->IDirectDrawSurface3_iface);
164 *obj = &This->IDirectDrawSurface3_iface;
165 TRACE("(%p) returning IDirectDrawSurface3 interface at %p\n", This, *obj);
166 return S_OK;
167 }
168
169 if (IsEqualGUID(riid, &IID_IDirectDrawSurface2))
170 {
171 IDirectDrawSurface2_AddRef(&This->IDirectDrawSurface2_iface);
172 *obj = &This->IDirectDrawSurface2_iface;
173 TRACE("(%p) returning IDirectDrawSurface2 interface at %p\n", This, *obj);
174 return S_OK;
175 }
176
177 if (IsEqualGUID(riid, &IID_IDirectDrawSurface)
179 {
180 IDirectDrawSurface_AddRef(&This->IDirectDrawSurface_iface);
181 *obj = &This->IDirectDrawSurface_iface;
182 TRACE("(%p) returning IDirectDrawSurface interface at %p\n", This, *obj);
183 return S_OK;
184 }
185
186 if (IsEqualGUID(riid, &IID_IDirectDrawGammaControl))
187 {
188 IDirectDrawGammaControl_AddRef(&This->IDirectDrawGammaControl_iface);
189 *obj = &This->IDirectDrawGammaControl_iface;
190 TRACE("(%p) returning IDirectDrawGammaControl interface at %p\n", This, *obj);
191 return S_OK;
192 }
193
194 if (IsEqualGUID(riid, &IID_IDirectDrawColorControl))
195 {
196 WARN("Color control not implemented.\n");
197 *obj = NULL;
198 return E_NOINTERFACE;
199 }
200
201 if (This->version != 7)
202 {
204 || IsEqualGUID(riid, &IID_IDirect3DHALDevice)
205 || IsEqualGUID(riid, &IID_IDirect3DRGBDevice))
206 {
208 if (!This->device1)
209 {
210 HRESULT hr;
211
212 if (FAILED(hr = d3d_device_create(This->ddraw, riid, This, (IUnknown *)&This->IDirectDrawSurface_iface,
213 1, &This->device1, (IUnknown *)&This->IDirectDrawSurface_iface)))
214 {
215 This->device1 = NULL;
217 WARN("Failed to create device, hr %#x.\n", hr);
218 return hr;
219 }
220 }
222
223 IDirect3DDevice_AddRef(&This->device1->IDirect3DDevice_iface);
224 *obj = &This->device1->IDirect3DDevice_iface;
225 return S_OK;
226 }
227
228 if (IsEqualGUID(&IID_IDirect3DTexture2, riid))
229 {
230 IDirect3DTexture2_AddRef(&This->IDirect3DTexture2_iface);
231 *obj = &This->IDirect3DTexture2_iface;
232 return S_OK;
233 }
234
235 if (IsEqualGUID( &IID_IDirect3DTexture, riid ))
236 {
237 IDirect3DTexture2_AddRef(&This->IDirect3DTexture_iface);
238 *obj = &This->IDirect3DTexture_iface;
239 return S_OK;
240 }
241 }
242
243 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
244
245 if (This->version != 7)
246 return E_INVALIDARG;
247
248 return E_NOINTERFACE;
249}
const GUID IID_IUnknown
#define IDirect3DDevice_AddRef(p)
Definition: d3d.h:965
#define IDirect3DTexture2_AddRef(p)
Definition: d3d.h:627
HRESULT d3d_device_create(struct ddraw *ddraw, const GUID *guid, struct ddraw_surface *target, IUnknown *rt_iface, UINT version, struct d3d_device **device, IUnknown *outer_unknown) DECLSPEC_HIDDEN
Definition: device.c:6980
#define E_INVALIDARG
Definition: ddrawi.h:101
const GUID IID_D3DDEVICE_WineD3D
Definition: device.c:39
#define S_OK
Definition: intsafe.h:52
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by d3d_texture1_QueryInterface(), d3d_texture2_QueryInterface(), ddraw_gamma_control_QueryInterface(), ddraw_surface1_QueryInterface(), ddraw_surface2_QueryInterface(), ddraw_surface3_QueryInterface(), and ddraw_surface4_QueryInterface().

◆ ddraw_surface7_Release()

static ULONG WINAPI ddraw_surface7_Release ( IDirectDrawSurface7 iface)
static

Definition at line 601 of file surface.c.

602{
604 ULONG refcount = InterlockedDecrement(&This->ref7);
605
606 TRACE("iface %p decreasing refcount to %u.\n", iface, refcount);
607
608 if (refcount == 0)
609 {
611 }
612
613 return refcount;
614}

Referenced by ddraw_surface1_GetAttachedSurface(), ddraw_surface2_GetAttachedSurface(), ddraw_surface3_GetAttachedSurface(), ddraw_surface4_GetAttachedSurface(), ddraw_surface7_Flip(), EnumCallback(), EnumCallback2(), and get_sub_mimaplevel().

◆ ddraw_surface7_ReleaseDC()

static HRESULT WINAPI ddraw_surface7_ReleaseDC ( IDirectDrawSurface7 iface,
HDC  hdc 
)
static

Definition at line 2308 of file surface.c.

2309{
2310 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
2311 HRESULT hr;
2312
2313 TRACE("iface %p, dc %p.\n", iface, hdc);
2314#ifdef __REACTOS__
2315 GdiFlush();
2316#endif
2318 if (!surface->dc)
2319 {
2320 hr = DDERR_NODC;
2321 }
2323 {
2324 surface->dc = NULL;
2327 }
2329
2330
2331 return hr;
2332}
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
Definition: texture.c:3671
HDC hdc
Definition: main.c:9
#define DDERR_NODC
Definition: ddraw.h:160
BOOL WINAPI GdiFlush(void)
Definition: misc.c:44

Referenced by ddraw_surface1_ReleaseDC(), ddraw_surface2_ReleaseDC(), ddraw_surface3_ReleaseDC(), and ddraw_surface4_ReleaseDC().

◆ ddraw_surface7_Restore()

static HRESULT WINAPI ddraw_surface7_Restore ( IDirectDrawSurface7 iface)
static

Definition at line 3670 of file surface.c.

3671{
3672 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
3673
3674 TRACE("iface %p.\n", iface);
3675
3677 {
3678 struct wined3d_swapchain *swapchain = surface->ddraw->wined3d_swapchain;
3679 struct wined3d_sub_resource_desc wined3d_desc;
3681 HRESULT hr;
3682
3684 {
3685 WARN("Failed to get display mode, hr %#x.\n", hr);
3686 return hr;
3687 }
3688
3689 if (FAILED(hr = wined3d_texture_get_sub_resource_desc(surface->wined3d_texture, 0, &wined3d_desc)))
3690 {
3691 WARN("Failed to get resource desc, hr %#x.\n", hr);
3692 return hr;
3693 }
3694
3695 if (mode.width != wined3d_desc.width || mode.height != wined3d_desc.height)
3696 {
3697 WARN("Display mode dimensions %ux%u don't match surface dimensions %ux%u.\n",
3698 mode.width, mode.height, wined3d_desc.width, wined3d_desc.height);
3699 return DDERR_WRONGMODE;
3700 }
3701
3702 if (mode.format_id != wined3d_desc.format)
3703 {
3704 WARN("Display mode format %#x doesn't match surface format %#x.\n",
3705 mode.format_id, wined3d_desc.format);
3706 return DDERR_WRONGMODE;
3707 }
3708 }
3709
3711 surface->is_lost = FALSE;
3712
3713 return DD_OK;
3714}
void ddraw_update_lost_surfaces(struct ddraw *ddraw)
Definition: ddraw.c:4918
HRESULT CDECL wined3d_texture_get_sub_resource_desc(const struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc)
Definition: texture.c:3480
GLenum mode
Definition: glext.h:6217
#define DDERR_WRONGMODE
Definition: ddraw.h:161
HRESULT CDECL wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
Definition: swapchain.c:248

Referenced by ddraw_surface1_Restore(), ddraw_surface2_Restore(), ddraw_surface3_Restore(), and ddraw_surface4_Restore().

◆ ddraw_surface7_SetClipper()

static HRESULT WINAPI ddraw_surface7_SetClipper ( IDirectDrawSurface7 iface,
IDirectDrawClipper *  iclipper 
)
static

Definition at line 4447 of file surface.c.

4449{
4451 struct ddraw_clipper *clipper = unsafe_impl_from_IDirectDrawClipper(iclipper);
4452 struct ddraw_clipper *old_clipper = This->clipper;
4453 HWND clipWindow;
4454
4455 TRACE("iface %p, clipper %p.\n", iface, iclipper);
4456
4458 if (clipper == This->clipper)
4459 {
4461 return DD_OK;
4462 }
4463
4464 This->clipper = clipper;
4465
4466 if (clipper != NULL)
4467 IDirectDrawClipper_AddRef(iclipper);
4468 if (old_clipper)
4469 IDirectDrawClipper_Release(&old_clipper->IDirectDrawClipper_iface);
4470
4471 if ((This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) && This->ddraw->wined3d_swapchain)
4472 {
4473 clipWindow = NULL;
4474 if(clipper) {
4475 IDirectDrawClipper_GetHWnd(iclipper, &clipWindow);
4476 }
4477
4478 if (clipWindow)
4479 {
4480 wined3d_swapchain_set_window(This->ddraw->wined3d_swapchain, clipWindow);
4481 ddraw_set_swapchain_window(This->ddraw, clipWindow);
4482 }
4483 else
4484 {
4485 wined3d_swapchain_set_window(This->ddraw->wined3d_swapchain, This->ddraw->d3d_window);
4486 ddraw_set_swapchain_window(This->ddraw, This->ddraw->dest_window);
4487 }
4488 }
4489
4491
4492 return DD_OK;
4493}
static void ddraw_set_swapchain_window(struct ddraw *ddraw, HWND window)
struct ddraw_clipper * unsafe_impl_from_IDirectDrawClipper(IDirectDrawClipper *iface)
Definition: clipper.c:329
IDirectDrawClipper IDirectDrawClipper_iface
void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window)
Definition: swapchain.c:140

Referenced by ddraw_surface1_SetClipper(), ddraw_surface2_SetClipper(), ddraw_surface3_SetClipper(), and ddraw_surface4_SetClipper().

◆ ddraw_surface7_SetColorKey()

static HRESULT WINAPI ddraw_surface7_SetColorKey ( IDirectDrawSurface7 iface,
DWORD  flags,
DDCOLORKEY color_key 
)
static

Definition at line 4857 of file surface.c.

4858{
4859 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
4860
4861 TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
4862
4865
4867}
#define DDSCAPS2_MIPMAPSUBLEVEL
Definition: ddraw.h:304
#define DDERR_NOTONMIPMAPSUBLEVEL
Definition: ddraw.h:170

◆ ddraw_surface7_SetLOD()

static HRESULT WINAPI ddraw_surface7_SetLOD ( IDirectDrawSurface7 iface,
DWORD  MaxLOD 
)
static

Definition at line 4172 of file surface.c.

4173{
4174 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
4175 HRESULT hr;
4176
4177 TRACE("iface %p, lod %u.\n", iface, MaxLOD);
4178
4181 {
4183 return DDERR_INVALIDOBJECT;
4184 }
4185
4186 hr = wined3d_texture_set_lod(surface->wined3d_texture, MaxLOD);
4188
4189 return hr;
4190}
DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod)
Definition: texture.c:1186

◆ ddraw_surface7_SetOverlayPosition()

static HRESULT WINAPI ddraw_surface7_SetOverlayPosition ( IDirectDrawSurface7 iface,
LONG  x,
LONG  y 
)
static

Definition at line 3764 of file surface.c.

3765{
3766 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
3767 HRESULT hr;
3768
3769 TRACE("iface %p, x %d, y %d.\n", iface, x, y);
3770
3773 surface->sub_resource_idx, x, y);
3775
3776 return hr;
3777}
HRESULT CDECL wined3d_texture_set_overlay_position(struct wined3d_texture *texture, unsigned int sub_resource_idx, LONG x, LONG y)
Definition: texture.c:3356

Referenced by ddraw_surface1_SetOverlayPosition(), ddraw_surface2_SetOverlayPosition(), ddraw_surface3_SetOverlayPosition(), and ddraw_surface4_SetOverlayPosition().

◆ ddraw_surface7_SetPalette()

static HRESULT WINAPI ddraw_surface7_SetPalette ( IDirectDrawSurface7 iface,
IDirectDrawPalette *  palette 
)
static

Definition at line 4905 of file surface.c.

4906{
4907 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
4908
4909 TRACE("iface %p, palette %p.\n", iface, palette);
4910
4913 if (IDirectDrawSurface7_IsLost(iface) == DDERR_SURFACELOST)
4914 {
4915 WARN("Surface lost, returning DDERR_SURFACELOST.\n");
4916 return DDERR_SURFACELOST;
4917 }
4918
4919 return ddraw_surface_set_palette(surface, palette);
4920}

◆ ddraw_surface7_SetPriority()

static HRESULT WINAPI ddraw_surface7_SetPriority ( IDirectDrawSurface7 iface,
DWORD  priority 
)
static

Definition at line 2451 of file surface.c.

2452{
2453 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
2455 HRESULT hr;
2456 struct wined3d_resource *resource;
2457
2458 TRACE("iface %p, priority %u.\n", iface, priority);
2459
2461 /* No need to check for offscreen plain surfaces or mipmap sublevels. SetPriority
2462 * calls on such surfaces segfault on Windows. */
2463 if (!(surface->surface_desc.ddsCaps.dwCaps2 & managed))
2464 {
2465 WARN("Called on non-managed texture returning DDERR_INVALIDPARAMS.\n");
2467 }
2468 else
2469 {
2472 hr = DD_OK;
2473 }
2475
2476 return hr;
2477}
DWORD CDECL wined3d_resource_set_priority(struct wined3d_resource *resource, DWORD priority)
Definition: resource.c:263

◆ ddraw_surface7_SetPrivateData()

static HRESULT WINAPI ddraw_surface7_SetPrivateData ( IDirectDrawSurface7 iface,
REFGUID  tag,
void data,
DWORD  size,
DWORD  flags 
)
static

Definition at line 2526 of file surface.c.

2528{
2529 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
2530 HRESULT hr;
2531
2532 TRACE("iface %p, tag %s, data %p, data_size %u, flags %#x.\n",
2533 iface, debugstr_guid(tag), data, size, flags);
2534
2535 if (!data)
2536 {
2537 WARN("data is NULL, returning DDERR_INVALIDPARAMS.\n");
2538 return DDERR_INVALIDPARAMS;
2539 }
2540
2544 return hr_ddraw_from_wined3d(hr);
2545}
HRESULT hr_ddraw_from_wined3d(HRESULT hr) DECLSPEC_HIDDEN
Definition: utils.c:1206
static HRESULT wined3d_private_store_set_private_data(struct wined3d_private_store *store, const GUID *guid, const void *data, DWORD data_size, DWORD flags)
Definition: wined3d.h:2553

Referenced by ddraw_surface4_SetPrivateData().

◆ ddraw_surface7_SetSurfaceDesc()

static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc ( IDirectDrawSurface7 iface,
DDSURFACEDESC2 DDSD,
DWORD  Flags 
)
static

Definition at line 4547 of file surface.c.

4548{
4550 HRESULT hr;
4551 const DWORD allowed_flags = DDSD_LPSURFACE | DDSD_PIXELFORMAT | DDSD_WIDTH
4554 UINT pitch, width, height;
4555
4556 TRACE("iface %p, surface_desc %p, flags %#x.\n", iface, DDSD, Flags);
4557
4558 if (!DDSD)
4559 {
4560 WARN("DDSD is NULL, returning DDERR_INVALIDPARAMS\n");
4561 return DDERR_INVALIDPARAMS;
4562 }
4563 if (Flags)
4564 {
4565 WARN("Flags is %x, returning DDERR_INVALIDPARAMS\n", Flags);
4566 return DDERR_INVALIDPARAMS;
4567 }
4568 if (!(This->surface_desc.ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)
4569 || This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE
4570 || This->surface_desc.ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
4571 {
4572 WARN("Surface is not in system memory, returning DDERR_INVALIDSURFACETYPE.\n");
4574 }
4575
4576 /* Tests show that only LPSURFACE and PIXELFORMAT can be set, and LPSURFACE is required
4577 * for PIXELFORMAT to work */
4578 if (DDSD->dwFlags & ~allowed_flags)
4579 {
4580 WARN("Invalid flags (0x%08x) set, returning DDERR_INVALIDPARAMS\n", DDSD->dwFlags);
4581 return DDERR_INVALIDPARAMS;
4582 }
4583 if (!(DDSD->dwFlags & DDSD_LPSURFACE) || !DDSD->lpSurface)
4584 {
4585 WARN("DDSD_LPSURFACE is not set or lpSurface is NULL, returning DDERR_INVALIDPARAMS\n");
4586 return DDERR_INVALIDPARAMS;
4587 }
4588 if ((DDSD->dwFlags & DDSD_CAPS) && DDSD->ddsCaps.dwCaps)
4589 {
4590 WARN("DDSD_CAPS is set, returning DDERR_INVALIDCAPS.\n");
4591 return DDERR_INVALIDCAPS;
4592 }
4593 if (DDSD->dwFlags & DDSD_WIDTH)
4594 {
4595 if (!(DDSD->dwFlags & DDSD_PITCH))
4596 {
4597 WARN("DDSD_WIDTH is set, but DDSD_PITCH is not, returning DDERR_INVALIDPARAMS.\n");
4598 return DDERR_INVALIDPARAMS;
4599 }
4600 if (!DDSD->dwWidth || DDSD->u1.lPitch <= 0 || DDSD->u1.lPitch & 0x3)
4601 {
4602 WARN("Pitch is %d, width is %u, returning DDERR_INVALIDPARAMS.\n",
4603 DDSD->u1.lPitch, DDSD->dwWidth);
4604 return DDERR_INVALIDPARAMS;
4605 }
4606 if (DDSD->dwWidth != This->surface_desc.dwWidth)
4607 TRACE("Surface width changed from %u to %u.\n", This->surface_desc.dwWidth, DDSD->dwWidth);
4608 if (DDSD->u1.lPitch != This->surface_desc.u1.lPitch)
4609 TRACE("Surface pitch changed from %u to %u.\n", This->surface_desc.u1.lPitch, DDSD->u1.lPitch);
4610 pitch = DDSD->u1.lPitch;
4611 width = DDSD->dwWidth;
4612 }
4613 else if (DDSD->dwFlags & DDSD_PITCH)
4614 {
4615 WARN("DDSD_PITCH is set, but DDSD_WIDTH is not, returning DDERR_INVALIDPARAMS.\n");
4616 return DDERR_INVALIDPARAMS;
4617 }
4618 else
4619 {
4620 pitch = This->surface_desc.u1.lPitch;
4621 width = This->surface_desc.dwWidth;
4622 }
4623
4624 if (DDSD->dwFlags & DDSD_HEIGHT)
4625 {
4626 if (!DDSD->dwHeight)
4627 {
4628 WARN("Height is 0, returning DDERR_INVALIDPARAMS.\n");
4629 return DDERR_INVALIDPARAMS;
4630 }
4631 if (DDSD->dwHeight != This->surface_desc.dwHeight)
4632 TRACE("Surface height changed from %u to %u.\n", This->surface_desc.dwHeight, DDSD->dwHeight);
4633 height = DDSD->dwHeight;
4634 }
4635 else
4636 {
4637 height = This->surface_desc.dwHeight;
4638 }
4639
4641 if (DDSD->dwFlags & DDSD_PIXELFORMAT)
4642 {
4643 enum wined3d_format_id current_format_id;
4645
4647 {
4648 ERR("Requested to set an unknown pixelformat\n");
4650 return DDERR_INVALIDPARAMS;
4651 }
4652 current_format_id = wined3dformat_from_ddrawformat(&This->surface_desc.u4.ddpfPixelFormat);
4653 if (format_id != current_format_id)
4654 TRACE("Surface format changed from %#x to %#x.\n", current_format_id, format_id);
4655 }
4656 else
4657 {
4658 format_id = wined3dformat_from_ddrawformat(&This->surface_desc.u4.ddpfPixelFormat);
4659 }
4660
4661 if (FAILED(hr = wined3d_texture_update_desc(This->wined3d_texture, width, height,
4662 format_id, WINED3D_MULTISAMPLE_NONE, 0, DDSD->lpSurface, pitch)))
4663 {
4664 WARN("Failed to update surface desc, hr %#x.\n", hr);
4666 return hr_ddraw_from_wined3d(hr);
4667 }
4668
4669 if (DDSD->dwFlags & DDSD_WIDTH)
4670 This->surface_desc.dwWidth = width;
4671 if (DDSD->dwFlags & DDSD_PITCH)
4672 This->surface_desc.u1.lPitch = DDSD->u1.lPitch;
4673 if (DDSD->dwFlags & DDSD_HEIGHT)
4674 This->surface_desc.dwHeight = height;
4675 if (DDSD->dwFlags & DDSD_PIXELFORMAT)
4676 This->surface_desc.u4.ddpfPixelFormat = DDSD->u4.ddpfPixelFormat;
4677
4679
4680 return DD_OK;
4681}
enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *format) DECLSPEC_HIDDEN
Definition: utils.c:333
#define DDSD_LPSURFACE
Definition: ddrawex.h:22
HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT width, UINT height, enum wined3d_format_id format_id, enum wined3d_multisample_type multisample_type, UINT multisample_quality, void *mem, UINT pitch)
Definition: texture.c:1356
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
static UINT format_id
Definition: clipboard.c:1343
#define DDSD_WIDTH
Definition: ddraw.h:210
#define DDSD_PIXELFORMAT
Definition: ddraw.h:216
#define DDSD_PITCH
Definition: ddraw.h:211
#define DDSD_HEIGHT
Definition: ddraw.h:209
#define DDERR_INVALIDCAPS
Definition: ddraw.h:75
#define DDSD_CAPS
Definition: ddraw.h:208
#define DDSCAPS_SYSTEMMEMORY
Definition: ddraw.h:261
#define DDERR_INVALIDSURFACETYPE
Definition: ddraw.h:166
LPVOID lpSurface
Definition: ddraw.h:1174
@ WINED3D_MULTISAMPLE_NONE
Definition: wined3d.h:554
wined3d_format_id
Definition: wined3d.h:106
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:107

Referenced by ddraw_surface3_SetSurfaceDesc(), and ddraw_surface4_SetSurfaceDesc().

◆ ddraw_surface7_Unlock()

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Unlock ( IDirectDrawSurface7 iface,
RECT pRect 
)
static

Definition at line 1172 of file surface.c.

1173{
1174 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
1175 HRESULT hr;
1176
1177 TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(pRect));
1178
1182 hr = ddraw_surface_update_frontbuffer(surface, &surface->ddraw->primary_lock, FALSE);
1184
1185 return hr;
1186}
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:382

Referenced by ddraw_surface1_Unlock(), ddraw_surface2_Unlock(), ddraw_surface3_Unlock(), and ddraw_surface4_Unlock().

◆ ddraw_surface7_UpdateOverlay()

static HRESULT WINAPI ddraw_surface7_UpdateOverlay ( IDirectDrawSurface7 iface,
RECT src_rect,
IDirectDrawSurface7 dst_surface,
RECT dst_rect,
DWORD  flags,
DDOVERLAYFX fx 
)
static

Definition at line 3830 of file surface.c.

3832{
3833 struct ddraw_surface *src_impl = impl_from_IDirectDrawSurface7(iface);
3834 struct ddraw_surface *dst_impl = unsafe_impl_from_IDirectDrawSurface7(dst_surface);
3835 struct wined3d_texture *dst_wined3d_texture = NULL;
3836 unsigned int dst_sub_resource_idx = 0;
3837 HRESULT hr;
3838
3839 TRACE("iface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n",
3840 iface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx);
3841
3842 if (fx)
3843 FIXME("Ignoring fx %p.\n", fx);
3844
3846 if (dst_impl)
3847 {
3848 dst_wined3d_texture = dst_impl->wined3d_texture;
3849 dst_sub_resource_idx = dst_impl->sub_resource_idx;
3850 }
3852 src_rect, dst_wined3d_texture, dst_sub_resource_idx, dst_rect, flags);
3854
3855 switch (hr)
3856 {
3860 default:
3861 return hr;
3862 }
3863}
HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, unsigned int sub_resource_idx, const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect, DWORD flags)
Definition: texture.c:3379
#define DDERR_NOTAOVERLAYSURFACE
Definition: ddraw.h:154
#define DDERR_OVERLAYNOTVISIBLE
Definition: ddraw.h:151
#define WINEDDERR_OVERLAYNOTVISIBLE
Definition: wined3d.h:53
#define WINEDDERR_NOTAOVERLAYSURFACE
Definition: wined3d.h:49

Referenced by ddraw_surface1_UpdateOverlay(), ddraw_surface2_UpdateOverlay(), ddraw_surface3_UpdateOverlay(), and ddraw_surface4_UpdateOverlay().

◆ ddraw_surface7_UpdateOverlayDisplay()

static HRESULT WINAPI ddraw_surface7_UpdateOverlayDisplay ( IDirectDrawSurface7 iface,
DWORD  Flags 
)
static

Definition at line 3928 of file surface.c.

3929{
3930 TRACE("iface %p, flags %#x.\n", iface, Flags);
3931
3932 return DDERR_UNSUPPORTED;
3933}

Referenced by ddraw_surface1_UpdateOverlayDisplay(), ddraw_surface2_UpdateOverlayDisplay(), ddraw_surface3_UpdateOverlayDisplay(), and ddraw_surface4_UpdateOverlayDisplay().

◆ ddraw_surface7_UpdateOverlayZOrder()

static HRESULT WINAPI ddraw_surface7_UpdateOverlayZOrder ( IDirectDrawSurface7 iface,
DWORD  flags,
IDirectDrawSurface7 reference 
)
static

Definition at line 3984 of file surface.c.

3986{
3987 struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
3988
3989 FIXME("iface %p, flags %#x, reference %p stub!\n", iface, flags, reference);
3990
3992 if (!(surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_OVERLAY))
3993 {
3994 WARN("Not an overlay surface.\n");
3997 }
3999
4000 return DD_OK;
4001}

Referenced by ddraw_surface1_UpdateOverlayZOrder(), ddraw_surface2_UpdateOverlayZOrder(), ddraw_surface3_UpdateOverlayZOrder(), and ddraw_surface4_UpdateOverlayZOrder().

◆ ddraw_surface_add_iface()

static void ddraw_surface_add_iface ( struct ddraw_surface surface)
static

Definition at line 315 of file surface.c.

316{
317 ULONG iface_count = InterlockedIncrement(&surface->iface_count);
318 TRACE("%p increasing iface count to %u.\n", surface, iface_count);
319
320 if (iface_count == 1)
321 {
322 if (surface->ifaceToRelease)
323 IUnknown_AddRef(surface->ifaceToRelease);
325 if (surface->wined3d_rtv)
329 }
330}
ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture)
Definition: texture.c:994
ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view)
Definition: view.c:318
IUnknown * ifaceToRelease

Referenced by ddraw_gamma_control_AddRef(), ddraw_surface1_AddRef(), ddraw_surface2_AddRef(), ddraw_surface3_AddRef(), ddraw_surface4_AddRef(), and ddraw_surface7_AddRef().

◆ ddraw_surface_attach_surface()

static HRESULT ddraw_surface_attach_surface ( struct ddraw_surface This,
struct ddraw_surface Surf 
)
static

Definition at line 1851 of file surface.c.

1852{
1853 TRACE("surface %p, attachment %p.\n", This, Surf);
1854
1855 if(Surf == This)
1856 return DDERR_CANNOTATTACHSURFACE; /* unchecked */
1857
1859
1860 /* Check if the surface is already attached somewhere */
1861 if (Surf->next_attached || Surf->first_attached != Surf)
1862 {
1863 /* TODO: Test for the structure of the manual attachment. Is it a
1864 * chain or a list? What happens if one surface is attached to 2
1865 * different surfaces? */
1866 WARN("Surface %p is already attached somewhere. next_attached %p, first_attached %p.\n",
1867 Surf, Surf->next_attached, Surf->first_attached);
1868
1871 }
1872
1873 /* This inserts the new surface at the 2nd position in the chain, right after the root surface */
1874 Surf->next_attached = This->next_attached;
1875 Surf->first_attached = This->first_attached;
1876 This->next_attached = Surf;
1877
1878 /* Check if the WineD3D depth stencil needs updating */
1879 if (This->ddraw->d3ddevice)
1880 d3d_device_update_depth_stencil(This->ddraw->d3ddevice);
1881
1883
1884 return DD_OK;
1885}
enum wined3d_depth_buffer_type d3d_device_update_depth_stencil(struct d3d_device *device) DECLSPEC_HIDDEN
Definition: device.c:6878
#define DDERR_SURFACEALREADYATTACHED
Definition: ddraw.h:117
struct ddraw_surface * first_attached

Referenced by ddraw_surface4_AddAttachedSurface(), and ddraw_surface7_AddAttachedSurface().

◆ ddraw_surface_blt()

static HRESULT ddraw_surface_blt ( struct ddraw_surface dst_surface,
const RECT dst_rect,
struct ddraw_surface src_surface,
const RECT src_rect,
DWORD  flags,
DWORD  fill_colour,
const struct wined3d_blt_fx fx,
enum wined3d_texture_filter_type  filter 
)
static

Definition at line 1407 of file surface.c.

1410{
1411 struct wined3d_device *wined3d_device = dst_surface->ddraw->wined3d_device;
1412 struct wined3d_color colour;
1413 DWORD wined3d_flags;
1414
1415 if (flags & DDBLT_COLORFILL)
1416 {
1418 dst_surface->palette, fill_colour, &colour))
1419 return DDERR_INVALIDPARAMS;
1420
1423 dst_rect, WINED3DCLEAR_TARGET, &colour, 0.0f, 0);
1424 }
1425
1426 if (flags & DDBLT_DEPTHFILL)
1427 {
1429 dst_surface->palette, fill_colour, &colour))
1430 return DDERR_INVALIDPARAMS;
1431
1434 dst_rect, WINED3DCLEAR_ZBUFFER, NULL, colour.r, 0);
1435 }
1436
1437 wined3d_flags = flags & ~DDBLT_ASYNC;
1438 if (wined3d_flags & ~WINED3D_BLT_MASK)
1439 {
1440 FIXME("Unhandled flags %#x.\n", flags);
1441 return E_NOTIMPL;
1442 }
1443
1444 if (!(flags & DDBLT_ASYNC))
1445 wined3d_flags |= WINED3D_BLT_SYNCHRONOUS;
1446
1447 return wined3d_texture_blt(dst_surface->wined3d_texture, dst_surface->sub_resource_idx, dst_rect,
1448 src_surface->wined3d_texture, src_surface->sub_resource_idx, src_rect, wined3d_flags, fx, filter);
1449}
BOOL wined3d_colour_from_ddraw_colour(const DDPIXELFORMAT *pf, const struct ddraw_palette *palette, DWORD colour, struct wined3d_color *wined3d_colour) DECLSPEC_HIDDEN
Definition: utils.c:596
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
Definition: device.c:4392
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define DDBLT_ASYNC
Definition: ddraw.h:554
#define WINED3DCLEAR_TARGET
Definition: wined3d.h:997
#define WINED3D_BLT_MASK
Definition: wined3d.h:1369
#define WINED3DCLEAR_ZBUFFER
Definition: wined3d.h:998

Referenced by ddraw_surface_blt_clipped().

◆ ddraw_surface_blt_clipped()

static HRESULT ddraw_surface_blt_clipped ( struct ddraw_surface dst_surface,
const RECT dst_rect_in,
struct ddraw_surface src_surface,
const RECT src_rect_in,
DWORD  flags,
DWORD  fill_colour,
const struct wined3d_blt_fx fx,
enum wined3d_texture_filter_type  filter 
)
static

Definition at line 1451 of file surface.c.

1454{
1455 RECT src_rect, dst_rect;
1456 float scale_x, scale_y;
1457 const RECT *clip_rect;
1458 UINT clip_list_size;
1459 RGNDATA *clip_list;
1460 HRESULT hr = DD_OK;
1461 UINT i;
1462
1463 if (!dst_rect_in)
1464 SetRect(&dst_rect, 0, 0, dst_surface->surface_desc.dwWidth,
1465 dst_surface->surface_desc.dwHeight);
1466 else
1467 dst_rect = *dst_rect_in;
1468
1469 if (IsRectEmpty(&dst_rect))
1470 return DDERR_INVALIDRECT;
1471
1472 if (src_surface)
1473 {
1474 if (!src_rect_in)
1475 SetRect(&src_rect, 0, 0, src_surface->surface_desc.dwWidth,
1476 src_surface->surface_desc.dwHeight);
1477 else
1478 src_rect = *src_rect_in;
1479
1480 if (IsRectEmpty(&src_rect))
1481 return DDERR_INVALIDRECT;
1482 }
1483 else
1484 {
1485 SetRectEmpty(&src_rect);
1486 }
1487
1488 if (!dst_surface->clipper)
1489 {
1490 if (src_surface && src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
1491 hr = ddraw_surface_update_frontbuffer(src_surface, &src_rect, TRUE);
1492 if (SUCCEEDED(hr))
1493 hr = ddraw_surface_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, fill_colour, fx, filter);
1495 hr = ddraw_surface_update_frontbuffer(dst_surface, &dst_rect, FALSE);
1496
1497 return hr;
1498 }
1499
1500 scale_x = (float)(src_rect.right - src_rect.left) / (float)(dst_rect.right - dst_rect.left);
1501 scale_y = (float)(src_rect.bottom - src_rect.top) / (float)(dst_rect.bottom - dst_rect.top);
1502
1503 if (FAILED(hr = IDirectDrawClipper_GetClipList(&dst_surface->clipper->IDirectDrawClipper_iface,
1504 &dst_rect, NULL, &clip_list_size)))
1505 {
1506 WARN("Failed to get clip list size, hr %#x.\n", hr);
1507 return hr;
1508 }
1509
1510 if (!(clip_list = heap_alloc(clip_list_size)))
1511 {
1512 WARN("Failed to allocate clip list.\n");
1513 return E_OUTOFMEMORY;
1514 }
1515
1516 if (FAILED(hr = IDirectDrawClipper_GetClipList(&dst_surface->clipper->IDirectDrawClipper_iface,
1517 &dst_rect, clip_list, &clip_list_size)))
1518 {
1519 WARN("Failed to get clip list, hr %#x.\n", hr);
1520 heap_free(clip_list);
1521 return hr;
1522 }
1523
1524 clip_rect = (RECT *)clip_list->Buffer;
1525 for (i = 0; i < clip_list->rdh.nCount; ++i)
1526 {
1527 RECT src_rect_clipped = src_rect;
1528
1529 if (src_surface)
1530 {
1531 src_rect_clipped.left += (LONG)((clip_rect[i].left - dst_rect.left) * scale_x);
1532 src_rect_clipped.top += (LONG)((clip_rect[i].top - dst_rect.top) * scale_y);
1533 src_rect_clipped.right -= (LONG)((dst_rect.right - clip_rect[i].right) * scale_x);
1534 src_rect_clipped.bottom -= (LONG)((dst_rect.bottom - clip_rect[i].bottom) * scale_y);
1535
1537 {
1538 if (FAILED(hr = ddraw_surface_update_frontbuffer(src_surface, &src_rect_clipped, TRUE)))
1539 break;
1540 }
1541 }
1542
1543 if (FAILED(hr = ddraw_surface_blt(dst_surface, &clip_rect[i],
1544 src_surface, &src_rect_clipped, flags, fill_colour, fx, filter)))
1545 break;
1546
1548 {
1549 if (FAILED(hr = ddraw_surface_update_frontbuffer(dst_surface, &clip_rect[i], FALSE)))
1550 break;
1551 }
1552 }
1553
1554 heap_free(clip_list);
1555 return hr;
1556}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT ddraw_surface_blt(struct ddraw_surface *dst_surface, const RECT *dst_rect, struct ddraw_surface *src_surface, const RECT *src_rect, DWORD flags, DWORD fill_colour, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: surface.c:1407
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
#define for
Definition: utility.h:88
static float(__cdecl *square_half_float)(float x
long LONG
Definition: pedump.c:60
RGNDATAHEADER rdh
Definition: axextend.idl:399
char Buffer[1]
Definition: axextend.idl:400
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)

Referenced by ddraw_surface7_Blt().

◆ ddraw_surface_cleanup()

static void ddraw_surface_cleanup ( struct ddraw_surface surface)
static

Definition at line 490 of file surface.c.

491{
492 struct ddraw_surface *surf;
493 UINT i;
494
495 TRACE("surface %p.\n", surface);
496
497 /* The refcount test shows that the palette is detached when the surface
498 * is destroyed. */
500
501 /* Loop through all complex attached surfaces and destroy them.
502 *
503 * Yet again, only the root can have more than one complexly attached
504 * surface, all the others have a total of one. */
505 for (i = 0; i < MAX_COMPLEX_ATTACHED; ++i)
506 {
507 if (!surface->complex_array[i])
508 break;
509
510 surf = surface->complex_array[i];
511 surface->complex_array[i] = NULL;
512 if (!surf->is_complex_root)
514 }
515
516 if (surface->device1)
517 IUnknown_Release(&surface->device1->IUnknown_inner);
518
519 if (surface->iface_count > 1)
520 {
521 /* This can happen when a complex surface is destroyed, because the
522 * 2nd surface was addref()ed when the app called
523 * GetAttachedSurface(). */
524 WARN("Destroying surface %p with refcounts 7: %u 4: %u 3: %u 2: %u 1: %u.\n",
525 surface, surface->ref7, surface->ref4, surface->ref3, surface->ref2, surface->ref1);
526 }
527
528 if (surface->wined3d_rtv)
531}
static void ddraw_surface_cleanup(struct ddraw_surface *surface)
Definition: surface.c:490
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1023
ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view)
Definition: view.c:348
struct d3d_device * device1

Referenced by ddraw_surface_cleanup(), and ddraw_surface_release_iface().

◆ ddraw_surface_create()

HRESULT ddraw_surface_create ( struct ddraw ddraw,
const DDSURFACEDESC2 surface_desc,
struct ddraw_surface **  surface,
IUnknown outer_unknown,
unsigned int  version 
)

Definition at line 5791 of file surface.c.

5793{
5794 struct wined3d_sub_resource_desc wined3d_mip_desc;
5795 struct ddraw_surface *root, *mip, **attach;
5796 struct wined3d_resource_desc wined3d_desc;
5799 DDSURFACEDESC2 *desc, *mip_desc;
5800 struct ddraw_texture *texture;
5801 unsigned int layers = 1;
5802 unsigned int pitch = 0;
5803 UINT levels, i, j;
5804 HRESULT hr;
5805
5806 TRACE("ddraw %p, surface_desc %p, surface %p, outer_unknown %p, version %u.\n",
5807 ddraw, surface_desc, surface, outer_unknown, version);
5808 if (TRACE_ON(ddraw))
5809 {
5810 TRACE("Requesting surface desc:\n");
5812 }
5813
5814 if (outer_unknown)
5815 return CLASS_E_NOAGGREGATION;
5816
5817 if (!surface)
5818 return E_POINTER;
5819
5820 if (!(texture = heap_alloc(sizeof(*texture))))
5821 return E_OUTOFMEMORY;
5822
5823 texture->version = version;
5824 texture->surface_desc = *surface_desc;
5825 desc = &texture->surface_desc;
5826
5827 /* Ensure DDSD_CAPS is always set. */
5828 desc->dwFlags |= DDSD_CAPS;
5829
5830 if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP)
5831 {
5832 if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->u5.dwBackBufferCount)
5833 {
5834 WARN("Tried to create a flippable surface without any back buffers.\n");
5836 return DDERR_INVALIDCAPS;
5837 }
5838
5839 if (!(desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX))
5840 {
5841 WARN("Tried to create a flippable surface without DDSCAPS_COMPLEX.\n");
5843 return DDERR_INVALIDCAPS;
5844 }
5845
5846 if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
5847 {
5848 WARN("Tried to create a flippable cubemap.\n");
5850 return DDERR_INVALIDPARAMS;
5851 }
5852
5853 if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
5854 {
5855 FIXME("Flippable textures not implemented.\n");
5857 return DDERR_INVALIDCAPS;
5858 }
5859 }
5860 else
5861 {
5862 if (desc->dwFlags & DDSD_BACKBUFFERCOUNT)
5863 {
5864 WARN("Tried to specify a back buffer count for a non-flippable surface.\n");
5867 return hr;
5868 }
5869 }
5870
5871 if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
5872 {
5873 if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
5874 {
5875 WARN("Tried to create a primary surface with DDSCAPS_TEXTURE.\n");
5877 return DDERR_INVALIDCAPS;
5878 }
5879
5880 if ((desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX) && !(desc->ddsCaps.dwCaps & DDSCAPS_FLIP))
5881 {
5882 WARN("Tried to create a flippable primary surface without both DDSCAPS_FLIP and DDSCAPS_COMPLEX.\n");
5884 return DDERR_INVALIDCAPS;
5885 }
5886
5887 if ((desc->ddsCaps.dwCaps & DDSCAPS_FLIP) && !(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
5888 {
5889 WARN("Tried to create a flippable primary surface without DDSCL_EXCLUSIVE.\n");
5891 return DDERR_NOEXCLUSIVEMODE;
5892 }
5893 }
5894
5895 /* This is a special case in ddrawex, but not allowed in ddraw. */
5896 if ((desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
5898 {
5899 WARN("Tried to create a surface in both system and video memory.\n");
5901 return DDERR_INVALIDCAPS;
5902 }
5903
5904 if ((desc->ddsCaps.dwCaps & (DDSCAPS_ALLOCONLOAD | DDSCAPS_MIPMAP))
5905 && !(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
5906 {
5907 WARN("Caps %#x require DDSCAPS_TEXTURE.\n", desc->ddsCaps.dwCaps);
5909 return DDERR_INVALIDCAPS;
5910 }
5911
5912 if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES)
5913 && !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP))
5914 {
5915 WARN("Cube map faces requested without cube map flag.\n");
5917 return DDERR_INVALIDCAPS;
5918 }
5919
5920 if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
5921 && !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES))
5922 {
5923 WARN("Cube map without faces requested.\n");
5925 return DDERR_INVALIDPARAMS;
5926 }
5927
5928 if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
5929 && (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) != DDSCAPS2_CUBEMAP_ALLFACES)
5930 FIXME("Partial cube maps not implemented.\n");
5931
5932 if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
5933 {
5934 if (!(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
5935 {
5936 WARN("DDSCAPS2_TEXTUREMANAGE used without DDSCAPS_TEXTURE, returning DDERR_INVALIDCAPS.\n");
5938 return DDERR_INVALIDCAPS;
5939 }
5940 if (desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
5941 {
5942 WARN("DDSCAPS2_TEXTUREMANAGE used width DDSCAPS_VIDEOMEMORY "
5943 "or DDSCAPS_SYSTEMMEMORY, returning DDERR_INVALIDCAPS.\n");
5945 return DDERR_INVALIDCAPS;
5946 }
5947 }
5948
5950 {
5951 ERR("Failed to get display mode, hr %#x.\n", hr);
5953 return hr_ddraw_from_wined3d(hr);
5954 }
5955
5956 /* No pixelformat given? Use the current screen format. */
5957 if (!(desc->dwFlags & DDSD_PIXELFORMAT))
5958 {
5959 desc->dwFlags |= DDSD_PIXELFORMAT;
5960 desc->u4.ddpfPixelFormat.dwSize = sizeof(desc->u4.ddpfPixelFormat);
5961 ddrawformat_from_wined3dformat(&desc->u4.ddpfPixelFormat, mode.format_id);
5962 }
5963
5964 wined3d_desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
5965 wined3d_desc.format = wined3dformat_from_ddrawformat(&desc->u4.ddpfPixelFormat);
5966 if (wined3d_desc.format == WINED3DFMT_UNKNOWN)
5967 {
5968 WARN("Unsupported / unknown pixelformat.\n");
5971 }
5972
5973 /* No width or no height? Use the screen size. */
5974 if (!(desc->dwFlags & DDSD_WIDTH) || !(desc->dwFlags & DDSD_HEIGHT))
5975 {
5976 if (!(desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
5977 {
5978 WARN("No width / height specified.\n");
5980 return DDERR_INVALIDPARAMS;
5981 }
5982
5983 desc->dwFlags |= DDSD_WIDTH | DDSD_HEIGHT;
5984 desc->dwWidth = mode.width;
5985 desc->dwHeight = mode.height;
5986 }
5987
5988 if (!desc->dwWidth || !desc->dwHeight)
5989 {
5991 return DDERR_INVALIDPARAMS;
5992 }
5993
5994 if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP)
5995 desc->ddsCaps.dwCaps |= DDSCAPS_FRONTBUFFER;
5996
5997 if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
5998 {
5999 /* The first surface is a front buffer, the back buffers are created
6000 * afterwards. */
6001 desc->ddsCaps.dwCaps |= DDSCAPS_VISIBLE;
6003 {
6004 struct wined3d_swapchain_desc swapchain_desc;
6005
6007 swapchain_desc.backbuffer_width = mode.width;
6008 swapchain_desc.backbuffer_height = mode.height;
6009 swapchain_desc.backbuffer_format = mode.format_id;
6010
6012 &swapchain_desc, NULL, ddraw_reset_enum_callback, TRUE)))
6013 {
6014 ERR("Failed to reset device.\n");
6016 return hr_ddraw_from_wined3d(hr);
6017 }
6018
6020 !!swapchain_desc.enable_auto_depth_stencil);
6021 }
6022 }
6023
6024 wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
6025 wined3d_desc.multisample_quality = 0;
6026 wined3d_desc.usage = 0;
6028 wined3d_desc.width = desc->dwWidth;
6029 wined3d_desc.height = desc->dwHeight;
6030 wined3d_desc.depth = 1;
6031 wined3d_desc.size = 0;
6032
6033 if ((desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && (ddraw->flags & DDRAW_NO3D))
6034 {
6035 WARN("The application requests a 3D capable surface, but the ddraw object was created without 3D support.\n");
6036 /* Do not fail surface creation, only fail 3D device creation. */
6037 }
6038
6039 /* Mipmap count fixes */
6040 if (desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP)
6041 {
6042 if (desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX)
6043 {
6044 if (desc->dwFlags & DDSD_MIPMAPCOUNT)
6045 {
6046 /* Mipmap count is given, should not be 0. */
6047 if (!desc->u2.dwMipMapCount)
6048 {
6050 return DDERR_INVALIDPARAMS;
6051 }
6052 }
6053 else
6054 {
6055 /* Undocumented feature: Create sublevels until either the
6056 * width or the height is 1. */
6057 if (version == 7)
6058 desc->u2.dwMipMapCount = wined3d_log2i(max(desc->dwWidth, desc->dwHeight)) + 1;
6059 else
6060 desc->u2.dwMipMapCount = wined3d_log2i(min(desc->dwWidth, desc->dwHeight)) + 1;
6061 }
6062 }
6063 else
6064 {
6065 desc->u2.dwMipMapCount = 1;
6066 }
6067
6068 desc->dwFlags |= DDSD_MIPMAPCOUNT;
6069 levels = desc->u2.dwMipMapCount;
6070 }
6071 else
6072 {
6073 levels = 1;
6074 }
6075
6076 if (!(desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY)))
6077 {
6078 if (!(desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE)))
6079 {
6080 DWORD usage = 0;
6081
6082 if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
6084 else if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
6086
6087 if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
6089 else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
6091
6093 WINED3D_DEVICE_TYPE_HAL, mode.format_id, usage, WINED3D_RTYPE_TEXTURE_2D, wined3d_desc.format)))
6094 desc->ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
6095 else
6096 desc->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
6097 }
6098 else if (!(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
6099 {
6100 /* Tests show surfaces without memory flags get these flags added
6101 * right after creation. */
6102 desc->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY;
6103 }
6104 }
6105
6106 if ((desc->ddsCaps.dwCaps & (DDSCAPS_OVERLAY | DDSCAPS_SYSTEMMEMORY))
6108 {
6109 WARN("System memory overlays are not allowed.\n");
6111 return DDERR_NOOVERLAYHW;
6112 }
6113
6114 if (desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)
6115 {
6116 /*
6117 * The ddraw RGB device allows to use system memory surfaces as rendering target.
6118 * This does not cause problems because the RGB device does software rasterization
6119 * though it will fail with hardware accelerated ddraw. In order to be partially
6120 * compatible with games requesting explicitly the RGB device, we ignore the
6121 * specified location and try to create rendering targets in video memory if
6122 * possible.
6123 */
6124 if ((desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) &&
6127 WINED3D_RTYPE_TEXTURE_2D, wined3d_desc.format)))
6128 {
6129 FIXME("Application wants to create rendering target in system memory, using video memory instead\n");
6130 wined3d_desc.usage |= WINED3DUSAGE_RENDERTARGET;
6131 }
6132 else
6133 wined3d_desc.access = WINED3D_RESOURCE_ACCESS_CPU
6135 }
6136 else
6137 {
6138 if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
6139 wined3d_desc.usage |= WINED3DUSAGE_TEXTURE;
6140 if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
6141 wined3d_desc.usage |= WINED3DUSAGE_DEPTHSTENCIL;
6142 else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
6143 wined3d_desc.usage |= WINED3DUSAGE_RENDERTARGET;
6144
6145 if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
6146 {
6149 /* Managed textures have the system memory flag set. */
6150 desc->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
6151 }
6152 else if (desc->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
6153 {
6154 /* Videomemory adds localvidmem. This is mutually exclusive with
6155 * systemmemory and texturemanage. */
6156 desc->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM;
6157 wined3d_desc.usage |= WINED3DUSAGE_DYNAMIC;
6158 }
6159 }
6160
6161 if (desc->dwFlags & DDSD_LPSURFACE)
6162 {
6163 if (wined3d_desc.access & WINED3D_RESOURCE_ACCESS_GPU)
6164 {
6165 WARN("User memory surfaces should not be GPU accessible.\n");
6167 return DDERR_INVALIDCAPS;
6168 }
6169
6170 if (version < 4)
6171 {
6172 WARN("User memory surfaces not supported before version 4.\n");
6174 return DDERR_INVALIDPARAMS;
6175 }
6176
6177 if (!desc->lpSurface)
6178 {
6179 WARN("NULL surface memory pointer specified.\n");
6181 return DDERR_INVALIDPARAMS;
6182 }
6183
6184 if (format_is_compressed(&desc->u4.ddpfPixelFormat))
6185 {
6186 if (version != 4 && (desc->dwFlags & DDSD_PITCH))
6187 {
6188 WARN("Pitch specified on a compressed user memory surface.\n");
6190 return DDERR_INVALIDPARAMS;
6191 }
6192
6193 if (!(desc->dwFlags & (DDSD_LINEARSIZE | DDSD_PITCH)))
6194 {
6195 WARN("Compressed user memory surfaces should explicitly specify the linear size.\n");
6197 return DDERR_INVALIDPARAMS;
6198 }
6199
6200 if ((desc->dwFlags & DDSD_LINEARSIZE)
6202 wined3d_desc.format, wined3d_desc.width) * ((desc->dwHeight + 3) / 4))
6203 {
6204 WARN("Invalid linear size %u specified.\n", desc->u1.dwLinearSize);
6206 return DDERR_INVALIDPARAMS;
6207 }
6208 }
6209 else
6210 {
6211 if (!(desc->dwFlags & DDSD_PITCH))
6212 {
6213 WARN("User memory surfaces should explicitly specify the pitch.\n");
6215 return DDERR_INVALIDPARAMS;
6216 }
6217
6219 wined3d_desc.format, wined3d_desc.width) || desc->u1.lPitch & 3)
6220 {
6221 WARN("Invalid pitch %u specified.\n", desc->u1.lPitch);
6223 return DDERR_INVALIDPARAMS;
6224 }
6225
6226 pitch = desc->u1.lPitch;
6227 }
6228 }
6229
6230 if (((desc->dwFlags & DDSD_CKDESTOVERLAY)
6231 && desc->u3.ddckCKDestOverlay.dwColorSpaceLowValue != desc->u3.ddckCKDestOverlay.dwColorSpaceHighValue)
6232 || ((desc->dwFlags & DDSD_CKDESTBLT)
6233 && desc->ddckCKDestBlt.dwColorSpaceLowValue != desc->ddckCKDestBlt.dwColorSpaceHighValue)
6234 || ((desc->dwFlags & DDSD_CKSRCOVERLAY)
6235 && desc->ddckCKSrcOverlay.dwColorSpaceLowValue != desc->ddckCKSrcOverlay.dwColorSpaceHighValue)
6236 || ((desc->dwFlags & DDSD_CKSRCBLT)
6237 && desc->ddckCKSrcBlt.dwColorSpaceLowValue != desc->ddckCKSrcBlt.dwColorSpaceHighValue))
6238 {
6239 WARN("Range color keys not supported, returning DDERR_NOCOLORKEYHW.\n");
6241 return DDERR_NOCOLORKEYHW;
6242 }
6243
6244 if (desc->ddsCaps.dwCaps & (DDSCAPS_OVERLAY))
6245 wined3d_desc.usage |= WINED3DUSAGE_OVERLAY;
6246
6247 if (desc->ddsCaps.dwCaps & DDSCAPS_OWNDC)
6248 wined3d_desc.usage |= WINED3DUSAGE_OWNDC;
6249
6250 if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
6251 {
6252 wined3d_desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
6253 layers = 6;
6254 }
6255
6256 /* Some applications assume surfaces will always be mapped at the same
6257 * address. Some of those also assume that this address is valid even when
6258 * the surface isn't mapped, and that updates done this way will be
6259 * visible on the screen. The game Nox is such an application,
6260 * Commandos: Behind Enemy Lines is another. Setting
6261 * WINED3D_TEXTURE_CREATE_GET_DC_LENIENT will ensure this. */
6262 if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, &wined3d_desc, layers, levels,
6265 {
6266 WARN("Failed to create wined3d texture, hr %#x.\n", hr);
6268 return hr_ddraw_from_wined3d(hr);
6269 }
6270
6273 root->is_complex_root = TRUE;
6274 texture->root = root;
6276
6277 if (desc->dwFlags & DDSD_CKDESTOVERLAY)
6279 (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay);
6280 if (desc->dwFlags & DDSD_CKDESTBLT)
6282 (struct wined3d_color_key *)&desc->ddckCKDestBlt);
6283 if (desc->dwFlags & DDSD_CKSRCOVERLAY)
6285 (struct wined3d_color_key *)&desc->ddckCKSrcOverlay);
6286 if (desc->dwFlags & DDSD_CKSRCBLT)
6288 (struct wined3d_color_key *)&desc->ddckCKSrcBlt);
6289
6290 for (i = 0; i < layers; ++i)
6291 {
6292 attach = &root->complex_array[layers - 1 - i];
6293
6294 for (j = 0; j < levels; ++j)
6295 {
6297 mip_desc = &mip->surface_desc;
6298
6299 if (j)
6300 {
6302 mip_desc->dwWidth = wined3d_mip_desc.width;
6303 mip_desc->dwHeight = wined3d_mip_desc.height;
6304
6305 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL;
6306 }
6307 else
6308 {
6309 mip_desc->ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL;
6310 }
6311
6312 if (mip_desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
6313 {
6314 mip_desc->ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES;
6315
6316 switch (i)
6317 {
6319 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX;
6320 break;
6322 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX;
6323 break;
6325 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEY;
6326 break;
6328 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEY;
6329 break;
6331 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEZ;
6332 break;
6334 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEZ;
6335 break;
6336 }
6337
6338 }
6339
6340 if (mip == root)
6341 continue;
6342
6343 *attach = mip;
6344 attach = &mip->complex_array[0];
6345 }
6346 }
6347
6349 wined3d_desc.width, wined3d_desc.height, wined3d_desc.format,
6350 WINED3D_MULTISAMPLE_NONE, 0, desc->lpSurface, pitch)))
6351 {
6352 ERR("Failed to set surface memory, hr %#x.\n", hr);
6353 goto fail;
6354 }
6355
6356 if (desc->dwFlags & DDSD_BACKBUFFERCOUNT)
6357 {
6358 unsigned int count = desc->u5.dwBackBufferCount;
6359 struct ddraw_surface *last = root;
6360
6361 attach = &last->complex_array[0];
6362 for (i = 0; i < count; ++i)
6363 {
6364 if (!(texture = heap_alloc(sizeof(*texture))))
6365 {
6366 hr = E_OUTOFMEMORY;
6367 goto fail;
6368 }
6369
6370 texture->version = version;
6371 texture->surface_desc = root->surface_desc;
6372 desc = &texture->surface_desc;
6373
6374 /* Only one surface in the flipping chain is a back buffer, one is
6375 * a front buffer, the others are just flippable surfaces. */
6378 if (!i)
6379 desc->ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER;
6380 desc->u5.dwBackBufferCount = 0;
6381
6382 if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, &wined3d_desc, 1, 1,
6385 {
6388 goto fail;
6389 }
6390
6393 texture->root = last;
6395
6396 if (desc->dwFlags & DDSD_CKDESTOVERLAY)
6398 (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay);
6399 if (desc->dwFlags & DDSD_CKDESTBLT)
6401 (struct wined3d_color_key *)&desc->ddckCKDestBlt);
6402 if (desc->dwFlags & DDSD_CKSRCOVERLAY)
6404 (struct wined3d_color_key *)&desc->ddckCKSrcOverlay);
6405 if (desc->dwFlags & DDSD_CKSRCBLT)
6407 (struct wined3d_color_key *)&desc->ddckCKSrcBlt);
6408
6409 *attach = last;
6410 attach = &last->complex_array[0];
6411 }
6412 *attach = root;
6413 }
6414
6416 ddraw->primary = root;
6417 *surface = root;
6418
6419 return DD_OK;
6420
6421fail:
6422 if (version == 7)
6423 IDirectDrawSurface7_Release(&root->IDirectDrawSurface7_iface);
6424 else if (version == 4)
6425 IDirectDrawSurface4_Release(&root->IDirectDrawSurface4_iface);
6426 else
6427 IDirectDrawSurface_Release(&root->IDirectDrawSurface_iface);
6428
6429 return hr;
6430}
struct _root root
static BOOL format_is_compressed(const DDPIXELFORMAT *format)
#define DDRAW_NO3D
Definition: ddraw_private.h:57
void ddrawformat_from_wined3dformat(DDPIXELFORMAT *ddraw_format, enum wined3d_format_id wined3d_format) DECLSPEC_HIDDEN
Definition: utils.c:33
static const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops
Definition: surface.c:5781
static HRESULT CDECL ddraw_reset_enum_callback(struct wined3d_resource *resource)
Definition: surface.c:5786
HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode, wined3d_device_reset_cb callback, BOOL reset_state)
Definition: device.c:4771
void CDECL wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value)
Definition: device.c:2027
ULONG CDECL wined3d_device_incref(struct wined3d_device *device)
Definition: device.c:456
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, UINT layer_count, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
Definition: texture.c:3511
void *CDECL wined3d_texture_get_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: texture.c:3449
HRESULT CDECL wined3d_texture_set_color_key(struct wined3d_texture *texture, DWORD flags, const struct wined3d_color_key *color_key)
Definition: texture.c:1235
static const WCHAR version[]
Definition: asmname.c:66
GLsizei levels
Definition: glext.h:7884
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static UINT UINT last
Definition: font.c:45
#define min(a, b)
Definition: monoChain.cc:55
#define DDSCAPS2_CUBEMAP_NEGATIVEZ
Definition: ddraw.h:296
#define DDSCAPS_ALLOCONLOAD
Definition: ddraw.h:274
#define DDSCAPS2_CUBEMAP_ALLFACES
Definition: ddraw.h:297
#define DDSCAPS_VISIBLE
Definition: ddraw.h:265
#define DDSD_MIPMAPCOUNT
Definition: ddraw.h:221
#define DDERR_INVALIDPIXELFORMAT
Definition: ddraw.h:80
#define DDSCAPS2_CUBEMAP_POSITIVEX
Definition: ddraw.h:291
#define DDERR_NOOVERLAYHW
Definition: ddraw.h:98
#define DDSCAPS2_CUBEMAP
Definition: ddraw.h:290
#define DDSCAPS_BACKBUFFER
Definition: ddraw.h:251
#define DDSCAPS2_CUBEMAP_NEGATIVEY
Definition: ddraw.h:294
#define DDERR_NOCOLORKEYHW
Definition: ddraw.h:91
#define DDSD_LINEARSIZE
Definition: ddraw.h:223
#define DDSCAPS2_CUBEMAP_POSITIVEY
Definition: ddraw.h:293
#define DDSCAPS2_CUBEMAP_NEGATIVEX
Definition: ddraw.h:292
#define DDSCAPS2_CUBEMAP_POSITIVEZ
Definition: ddraw.h:295
#define DDSCAPS_TEXTURE
Definition: ddraw.h:262
#define DDSCAPS_VIDEOMEMORY
Definition: ddraw.h:264
#define DDSCAPS_LOCALVIDMEM
Definition: ddraw.h:276
#define DDSCAPS_OWNDC
Definition: ddraw.h:268
#define DDSD_BACKBUFFERCOUNT
Definition: ddraw.h:212
#define DDSCAPS_COMPLEX
Definition: ddraw.h:252
DDSURFACEDESC2 surface_desc
DWORD flags
Definition: ddraw_private.h:94
struct ddraw_surface * primary
Definition: ddraw_private.h:97
struct wined3d_device * wined3d_device
Definition: ddraw_private.h:93
DWORD cooperative_level
struct wined3d_swapchain * wined3d_swapchain
struct wined3d * wined3d
Definition: ddraw_private.h:92
#define max(a, b)
Definition: svc.c:63
UINT CDECL wined3d_calculate_format_pitch(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_format_id format_id, UINT width)
Definition: directx.c:5517
HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
Definition: directx.c:5334
HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
Definition: directx.c:4767
void CDECL wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, struct wined3d_swapchain_desc *desc)
Definition: swapchain.c:271
@ WINED3D_CUBEMAP_FACE_NEGATIVE_Z
Definition: wined3d.h:680
@ WINED3D_CUBEMAP_FACE_NEGATIVE_X
Definition: wined3d.h:676
@ WINED3D_CUBEMAP_FACE_POSITIVE_Z
Definition: wined3d.h:679
@ WINED3D_CUBEMAP_FACE_POSITIVE_X
Definition: wined3d.h:675
@ WINED3D_CUBEMAP_FACE_NEGATIVE_Y
Definition: wined3d.h:678
@ WINED3D_CUBEMAP_FACE_POSITIVE_Y
Definition: wined3d.h:677
static unsigned int wined3d_log2i(unsigned int x)
Definition: wined3d.h:2759
@ WINED3D_RS_ZENABLE
Definition: wined3d.h:269
#define WINED3DUSAGE_OWNDC
Definition: wined3d.h:919
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:917
#define WINED3DADAPTER_DEFAULT
Definition: wined3d.h:857
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:56
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:700
#define WINED3DUSAGE_OVERLAY
Definition: wined3d.h:921
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
#define WINED3DUSAGE_RENDERTARGET
Definition: wined3d.h:899
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:907
#define WINED3D_TEXTURE_CREATE_GET_DC_LENIENT
Definition: wined3d.h:1560
@ WINED3D_DEVICE_TYPE_HAL
Definition: wined3d.h:87
#define WINED3DUSAGE_TEXTURE
Definition: wined3d.h:918
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
#define WINED3DUSAGE_DEPTHSTENCIL
Definition: wined3d.h:900
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define E_POINTER
Definition: winerror.h:2365

Referenced by ddraw1_CreateSurface(), ddraw2_CreateSurface(), ddraw4_CreateSurface(), and ddraw7_CreateSurface().

◆ ddraw_surface_delete_attached_surface()

static HRESULT ddraw_surface_delete_attached_surface ( struct ddraw_surface surface,
struct ddraw_surface attachment,
IUnknown detach_iface 
)
static

Definition at line 2022 of file surface.c.

2024{
2025 struct ddraw_surface *prev = surface;
2026
2027 TRACE("surface %p, attachment %p, detach_iface %p.\n", surface, attachment, detach_iface);
2028
2030 if (!attachment || (attachment->first_attached != surface) || (attachment == surface) )
2031 {
2034 }
2035
2036 if (attachment->attached_iface != detach_iface)
2037 {
2038 WARN("attachment->attach_iface %p != detach_iface %p.\n", attachment->attached_iface, detach_iface);
2041 }
2042
2043 /* Remove MIPMAPSUBLEVEL if this seemed to be one */
2044 if (surface->surface_desc.ddsCaps.dwCaps & attachment->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP)
2045 {
2046 attachment->surface_desc.ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL;
2047 /* FIXME: we should probably also subtract from dwMipMapCount of this
2048 * and all parent surfaces */
2049 }
2050
2051 /* Find the predecessor of the detached surface */
2052 while (prev->next_attached != attachment)
2053 {
2054 if (!(prev = prev->next_attached))
2055 {
2056 ERR("Failed to find predecessor of %p.\n", attachment);
2059 }
2060 }
2061
2062 /* Unchain the surface */
2063 prev->next_attached = attachment->next_attached;
2064 attachment->next_attached = NULL;
2065 attachment->first_attached = attachment;
2066
2067 /* Check if the wined3d depth stencil needs updating. Note that we don't
2068 * just call d3d_device_update_depth_stencil() here since it uses
2069 * QueryInterface(). Some applications, SCP - Containment Breach in
2070 * particular, modify the QueryInterface() pointer in the surface vtbl
2071 * but don't cleanup properly after the relevant dll is unloaded. */
2072 if (attachment->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER
2073 && wined3d_device_get_depth_stencil_view(surface->ddraw->wined3d_device) == attachment->wined3d_rtv)
2074 wined3d_device_set_depth_stencil_view(surface->ddraw->wined3d_device, NULL);
2076
2077 /* Set attached_iface to NULL before releasing it, the surface may go
2078 * away. */
2079 attachment->attached_iface = NULL;
2080 IUnknown_Release(detach_iface);
2081
2082 return DD_OK;
2083}
void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view)
Definition: device.c:4524
struct wined3d_rendertarget_view *CDECL wined3d_device_get_depth_stencil_view(const struct wined3d_device *device)
Definition: device.c:4461
#define DDERR_SURFACENOTATTACHED
Definition: ddraw.h:123
#define DDERR_CANNOTDETACHSURFACE
Definition: ddraw.h:69

Referenced by ddraw_surface1_DeleteAttachedSurface(), ddraw_surface2_DeleteAttachedSurface(), ddraw_surface3_DeleteAttachedSurface(), ddraw_surface4_DeleteAttachedSurface(), ddraw_surface7_DeleteAttachedSurface(), and ddraw_surface_wined3d_object_destroyed().

◆ ddraw_surface_get_rendertarget_view()

struct wined3d_rendertarget_view * ddraw_surface_get_rendertarget_view ( struct ddraw_surface surface)

Definition at line 6520 of file surface.c.

6521{
6522 HRESULT hr;
6523
6524 if (surface->wined3d_rtv)
6525 return surface->wined3d_rtv;
6526
6528 surface->sub_resource_idx, surface, &ddraw_view_wined3d_parent_ops, &surface->wined3d_rtv)))
6529 {
6530 ERR("Failed to create rendertarget view, hr %#x.\n", hr);
6531 return NULL;
6532 }
6533
6534 return surface->wined3d_rtv;
6535}
static const struct wined3d_parent_ops ddraw_view_wined3d_parent_ops
Definition: surface.c:6515
HRESULT CDECL wined3d_rendertarget_view_create_from_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_rendertarget_view **view)
Definition: view.c:624

Referenced by d3d_device_init(), d3d_device_set_render_target(), d3d_device_update_depth_stencil(), ddraw_surface7_Flip(), and ddraw_surface_blt().

◆ ddraw_surface_init()

void ddraw_surface_init ( struct ddraw_surface surface,
struct ddraw ddraw,
struct wined3d_texture wined3d_texture,
unsigned int  sub_resource_idx,
const struct wined3d_parent_ops **  parent_ops 
)

Definition at line 6432 of file surface.c.

6435{
6437 unsigned int texture_level, row_pitch, slice_pitch;
6438 DDSURFACEDESC2 *desc = &surface->surface_desc;
6439 unsigned int version = texture->version;
6440
6447 surface->IDirect3DTexture2_iface.lpVtbl = &d3d_texture2_vtbl;
6448 surface->IDirect3DTexture_iface.lpVtbl = &d3d_texture1_vtbl;
6449 surface->iface_count = 1;
6450 surface->version = version;
6451 surface->ddraw = ddraw;
6452
6453 if (version == 7)
6454 {
6455 surface->ref7 = 1;
6456 surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface7_iface;
6457 }
6458 else if (version == 4)
6459 {
6460 surface->ref4 = 1;
6461 surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface4_iface;
6462 }
6463 else
6464 {
6465 surface->ref1 = 1;
6466 surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface_iface;
6467 }
6468
6469 *desc = texture->surface_desc;
6470 surface->first_attached = surface;
6471
6472 texture_level = desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP ? sub_resource_idx % desc->u2.dwMipMapCount : 0;
6473 wined3d_texture_get_pitch(wined3d_texture, texture_level, &row_pitch, &slice_pitch);
6474 if (format_is_compressed(&desc->u4.ddpfPixelFormat))
6475 {
6476 if (desc->dwFlags & DDSD_LPSURFACE)
6477 desc->u1.dwLinearSize = ~0u;
6478 else
6479 desc->u1.dwLinearSize = slice_pitch;
6480 desc->dwFlags |= DDSD_LINEARSIZE;
6481 desc->dwFlags &= ~(DDSD_LPSURFACE | DDSD_PITCH);
6482 }
6483 else
6484 {
6485 if (!(desc->dwFlags & DDSD_LPSURFACE))
6486 desc->u1.lPitch = row_pitch;
6487 desc->dwFlags |= DDSD_PITCH;
6488 desc->dwFlags &= ~(DDSD_LPSURFACE | DDSD_LINEARSIZE);
6489 }
6490 desc->lpSurface = NULL;
6491
6493 surface->sub_resource_idx = sub_resource_idx;
6494 *parent_ops = &ddraw_surface_wined3d_parent_ops;
6495
6497}
static const struct IDirect3DTexture2Vtbl d3d_texture2_vtbl
Definition: surface.c:5617
static const struct IDirectDrawGammaControlVtbl ddraw_gamma_control_vtbl
Definition: surface.c:5608
static const struct IDirectDrawSurface2Vtbl ddraw_surface2_vtbl
Definition: surface.c:5520
static const struct IDirectDrawSurface3Vtbl ddraw_surface3_vtbl
Definition: surface.c:5472
static struct IDirectDrawSurfaceVtbl ddraw_surface1_vtbl
Definition: surface.c:5566
static const struct IDirectDrawSurface4Vtbl ddraw_surface4_vtbl
Definition: surface.c:5418
static const struct IDirect3DTextureVtbl d3d_texture1_vtbl
Definition: surface.c:5627
static const struct IDirectDrawSurface7Vtbl ddraw_surface7_vtbl
Definition: surface.c:5359
static const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops
Definition: surface.c:5769
void CDECL wined3d_texture_get_pitch(const struct wined3d_texture *texture, unsigned int level, unsigned int *row_pitch, unsigned int *slice_pitch)
Definition: texture.c:1168
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
IDirectDrawGammaControl IDirectDrawGammaControl_iface
IDirect3DTexture IDirect3DTexture_iface
static void wined3d_private_store_init(struct wined3d_private_store *store)
Definition: wined3d.h:2512

Referenced by device_parent_surface_created().

◆ ddraw_surface_release_iface()

static ULONG ddraw_surface_release_iface ( struct ddraw_surface This)
static

Definition at line 533 of file surface.c.

534{
535 ULONG iface_count;
536
537 /* Prevent the surface from being destroyed if it's still attached to
538 * another surface. It will be destroyed when the root is destroyed. */
539 if (This->iface_count == 1 && This->attached_iface)
540 IUnknown_AddRef(This->attached_iface);
541 iface_count = InterlockedDecrement(&This->iface_count);
542
543 TRACE("%p decreasing iface count to %u.\n", This, iface_count);
544
545 if (iface_count == 0)
546 {
547 struct ddraw_texture *texture = wined3d_texture_get_parent(This->wined3d_texture);
548 struct wined3d_device *wined3d_device = texture->wined3d_device;
549 IUnknown *release_iface = This->ifaceToRelease;
550
551 /* Complex attached surfaces are destroyed implicitly when the root is released */
553 if(!This->is_complex_root)
554 {
555 WARN("(%p) Attempt to destroy a surface that is not a complex root\n", This);
557 return iface_count;
558 }
561
562 if (release_iface)
563 IUnknown_Release(release_iface);
564 /* Release the device only after anything that may reference it (the
565 * wined3d texture and rendertarget view in particular) is released. */
567 }
568
569 return iface_count;
570}
ULONG CDECL wined3d_device_decref(struct wined3d_device *device)
Definition: device.c:472
#define release_iface(a)
Definition: tmarshal.c:43

Referenced by ddraw_gamma_control_Release(), ddraw_surface1_Release(), ddraw_surface2_Release(), ddraw_surface3_Release(), ddraw_surface4_Release(), and ddraw_surface7_Release().

◆ ddraw_surface_set_color_key()

static HRESULT ddraw_surface_set_color_key ( struct ddraw_surface surface,
DWORD  flags,
DDCOLORKEY color_key 
)
static

Definition at line 4775 of file surface.c.

4776{
4777 DDCOLORKEY fixed_color_key;
4779
4781 {
4782 if (color_key && color_key->dwColorSpaceLowValue != color_key->dwColorSpaceHighValue)
4783 {
4784 WARN("Range color keys are not supported, returning DDERR_NOCOLORKEYHW.\n");
4785 return DDERR_NOCOLORKEYHW;
4786 }
4787 flags &= ~DDCKEY_COLORSPACE;
4788 }
4789
4791
4792 if (color_key)
4793 {
4794 fixed_color_key.dwColorSpaceLowValue = fixed_color_key.dwColorSpaceHighValue = color_key->dwColorSpaceLowValue;
4795 switch (flags & ~DDCKEY_COLORSPACE)
4796 {
4797 case DDCKEY_DESTBLT:
4798 surface->surface_desc.ddckCKDestBlt = fixed_color_key;
4800 break;
4801
4802 case DDCKEY_DESTOVERLAY:
4803 surface->surface_desc.u3.ddckCKDestOverlay = fixed_color_key;
4805 break;
4806
4807 case DDCKEY_SRCOVERLAY:
4808 surface->surface_desc.ddckCKSrcOverlay = fixed_color_key;
4810 break;
4811
4812 case DDCKEY_SRCBLT:
4813 surface->surface_desc.ddckCKSrcBlt = fixed_color_key;
4815 break;
4816
4817 default:
4819 return DDERR_INVALIDPARAMS;
4820 }
4821 }
4822 else
4823 {
4824 switch (flags & ~DDCKEY_COLORSPACE)
4825 {
4826 case DDCKEY_DESTBLT:
4827 surface->surface_desc.dwFlags &= ~DDSD_CKDESTBLT;
4828 break;
4829
4830 case DDCKEY_DESTOVERLAY:
4831 surface->surface_desc.dwFlags &= ~DDSD_CKDESTOVERLAY;
4832 break;
4833
4834 case DDCKEY_SRCOVERLAY:
4835 surface->surface_desc.dwFlags &= ~DDSD_CKSRCOVERLAY;
4836 break;
4837
4838 case DDCKEY_SRCBLT:
4839 surface->surface_desc.dwFlags &= ~DDSD_CKSRCBLT;
4840 break;
4841
4842 default:
4844 return DDERR_INVALIDPARAMS;
4845 }
4846 }
4847
4848 if (surface->is_complex_root)
4850 color_key ? (struct wined3d_color_key *)&fixed_color_key : NULL);
4851
4853
4854 return hr_ddraw_from_wined3d(hr);
4855}
#define DDCKEY_COLORSPACE
Definition: ddraw.h:475
DDCOLORKEY ddckCKDestOverlay
Definition: ddraw.h:1177
DDCOLORKEY ddckCKSrcOverlay
Definition: ddraw.h:1181
DDCOLORKEY ddckCKDestBlt
Definition: ddraw.h:1180
DDCOLORKEY ddckCKSrcBlt
Definition: ddraw.h:1182
#define WINED3D_OK
Definition: wined3d.h:37

Referenced by ddraw_surface1_SetColorKey(), ddraw_surface2_SetColorKey(), ddraw_surface3_SetColorKey(), ddraw_surface4_SetColorKey(), and ddraw_surface7_SetColorKey().

◆ ddraw_surface_set_palette()

static HRESULT ddraw_surface_set_palette ( struct ddraw_surface surface,
IDirectDrawPalette *  palette 
)
static

Definition at line 449 of file surface.c.

450{
452 struct ddraw_palette *prev;
453
454 TRACE("iface %p, palette %p.\n", surface, palette);
455
456 if (palette_impl && palette_impl->flags & DDPCAPS_ALPHA
458 {
459 WARN("Alpha palette set on non-texture surface, returning DDERR_INVALIDSURFACETYPE.\n");
461 }
462
465
467
468 prev = surface->palette;
470 {
471 if (prev)
472 prev->flags &= ~DDPCAPS_PRIMARYSURFACE;
473 if (palette_impl)
474 palette_impl->flags |= DDPCAPS_PRIMARYSURFACE;
475 wined3d_swapchain_set_palette(surface->ddraw->wined3d_swapchain,
476 palette_impl ? palette_impl->wined3d_palette : NULL);
478 }
479 if (palette_impl)
480 IDirectDrawPalette_AddRef(&palette_impl->IDirectDrawPalette_iface);
481 if (prev)
482 IDirectDrawPalette_Release(&prev->IDirectDrawPalette_iface);
483 surface->palette = palette_impl;
484
486
487 return DD_OK;
488}
struct ddraw_palette * unsafe_impl_from_IDirectDrawPalette(IDirectDrawPalette *iface) DECLSPEC_HIDDEN
Definition: palette.c:234
#define DDPCAPS_PRIMARYSURFACE
Definition: ddraw.h:456
#define DDPCAPS_ALPHA
Definition: ddraw.h:462
struct wined3d_palette * wined3d_palette
void CDECL wined3d_swapchain_set_palette(struct wined3d_swapchain *swapchain, struct wined3d_palette *palette)
Definition: swapchain.c:296

Referenced by ddraw_surface1_SetPalette(), ddraw_surface2_SetPalette(), ddraw_surface3_SetPalette(), ddraw_surface4_SetPalette(), ddraw_surface7_SetPalette(), and ddraw_surface_cleanup().

◆ ddraw_surface_update_frontbuffer()

HRESULT ddraw_surface_update_frontbuffer ( struct ddraw_surface surface,
const RECT rect,
BOOL  read 
)

Definition at line 43 of file surface.c.

44{
45 struct ddraw *ddraw = surface->ddraw;
46 HDC surface_dc, screen_dc;
47 int x, y, w, h;
48 HRESULT hr;
49 BOOL ret;
50 RECT r;
51
52 if (!rect)
53 {
54 SetRect(&r, 0, 0, surface->surface_desc.dwWidth, surface->surface_desc.dwHeight);
55 rect = &r;
56 }
57
58 x = rect->left;
59 y = rect->top;
60 w = rect->right - rect->left;
61 h = rect->bottom - rect->top;
62
63 if (w <= 0 || h <= 0)
64 return DD_OK;
65
67 {
68 /* Nothing to do, we control the frontbuffer, or at least the parts we
69 * care about. */
70 if (read)
71 return DD_OK;
72
75 }
76
77 if (FAILED(hr = wined3d_texture_get_dc(surface->wined3d_texture, surface->sub_resource_idx, &surface_dc)))
78 {
79 ERR("Failed to get surface DC, hr %#x.\n", hr);
80 return hr;
81 }
82 if (surface->palette)
83 wined3d_palette_apply_to_dc(surface->palette->wined3d_palette, surface_dc);
84
85 if (!(screen_dc = GetDC(NULL)))
86 {
87 wined3d_texture_release_dc(surface->wined3d_texture, surface->sub_resource_idx, surface_dc);
88 ERR("Failed to get screen DC.\n");
89 return E_FAIL;
90 }
91
92 if (read)
93 ret = BitBlt(surface_dc, x, y, w, h,
94 screen_dc, x, y, SRCCOPY);
95 else
96 ret = BitBlt(screen_dc, x, y, w, h,
97 surface_dc, x, y, SRCCOPY);
98
99 ReleaseDC(NULL, screen_dc);
100 wined3d_texture_release_dc(surface->wined3d_texture, surface->sub_resource_idx, surface_dc);
101
102 if (!ret)
103 {
104 ERR("Failed to blit to/from screen.\n");
105 return E_FAIL;
106 }
107
108 return DD_OK;
109}
#define read
Definition: acwin.h:96
#define DDRAW_GDI_FLIP
Definition: ddraw_private.h:60
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
unsigned int BOOL
Definition: ntddk_ex.h:94
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
static HDC
Definition: imagelist.c:88
struct wined3d_texture * wined3d_frontbuffer
Definition: ddraw_private.h:99
HWND swapchain_window
int ret
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by ddraw_palette_SetEntries(), ddraw_surface7_BltFast(), ddraw_surface7_Flip(), ddraw_surface7_GetDC(), ddraw_surface7_ReleaseDC(), ddraw_surface7_Unlock(), ddraw_surface_blt_clipped(), ddraw_surface_set_palette(), and surface_lock().

◆ ddraw_surface_wined3d_object_destroyed()

static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed ( void parent)
static

Definition at line 5735 of file surface.c.

5736{
5737 struct ddraw_surface *surface = parent;
5738
5739 TRACE("surface %p.\n", surface);
5740
5741 /* This shouldn't happen, ddraw_surface_release_iface() should prevent the
5742 * surface from being destroyed in this case. */
5743 if (surface->first_attached != surface)
5744 ERR("Surface is still attached to surface %p.\n", surface->first_attached);
5745
5746 while (surface->next_attached)
5748 surface->next_attached, surface->next_attached->attached_iface)))
5749 ERR("DeleteAttachedSurface failed.\n");
5750
5751 /* Having a texture handle set implies that the device still exists. */
5752 if (surface->Handle)
5753 ddraw_free_handle(&surface->ddraw->d3ddevice->handle_table, surface->Handle - 1, DDRAW_HANDLE_SURFACE);
5754
5755 /* Reduce the ddraw surface count. */
5757
5758 if (surface->clipper)
5759 IDirectDrawClipper_Release(&surface->clipper->IDirectDrawClipper_iface);
5760
5761 if (surface == surface->ddraw->primary)
5762 surface->ddraw->primary = NULL;
5763
5765
5766 heap_free(surface);
5767}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
void * ddraw_free_handle(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type) DECLSPEC_HIDDEN
Definition: main.c:156
r parent
Definition: btrfs.c:3010
struct list surface_list_entry
static void wined3d_private_store_cleanup(struct wined3d_private_store *store)
Definition: wined3d.h:2541

◆ ddraw_texture_wined3d_object_destroyed()

static void STDMETHODCALLTYPE ddraw_texture_wined3d_object_destroyed ( void parent)
static

Definition at line 5774 of file surface.c.

5775{
5776 TRACE("parent %p.\n", parent);
5777
5779}

◆ EnumCallback()

static HRESULT CALLBACK EnumCallback ( IDirectDrawSurface7 surface,
DDSURFACEDESC2 surface_desc,
void context 
)
static

Definition at line 2903 of file surface.c.

2904{
2905 struct ddraw_surface *surface_impl = impl_from_IDirectDrawSurface7(surface);
2906 const struct callback_info *info = context;
2907
2909 ddraw_surface7_Release(surface);
2910
2911 /* FIXME: Check surface_test.dwSize */
2912 return info->callback(&surface_impl->IDirectDrawSurface_iface,
2913 (DDSURFACEDESC *)surface_desc, info->context);
2914}

Referenced by ddraw_surface1_EnumAttachedSurfaces(), ddraw_surface1_EnumOverlayZOrders(), ddraw_surface2_EnumAttachedSurfaces(), ddraw_surface2_EnumOverlayZOrders(), ddraw_surface3_EnumAttachedSurfaces(), and ddraw_surface3_EnumOverlayZOrders().

◆ EnumCallback2()

static HRESULT CALLBACK EnumCallback2 ( IDirectDrawSurface7 surface,
DDSURFACEDESC2 surface_desc,
void context 
)
static

Definition at line 2892 of file surface.c.

2893{
2894 struct ddraw_surface *surface_impl = impl_from_IDirectDrawSurface7(surface);
2895 const struct callback_info2 *info = context;
2896
2898 ddraw_surface7_Release(surface);
2899
2900 return info->callback(&surface_impl->IDirectDrawSurface4_iface, surface_desc, info->context);
2901}

Referenced by ddraw_surface4_EnumAttachedSurfaces(), and ddraw_surface4_EnumOverlayZOrders().

◆ get_sub_mimaplevel()

static struct ddraw_surface * get_sub_mimaplevel ( struct ddraw_surface surface)
static

Definition at line 5177 of file surface.c.

5178{
5179 /* Now go down the mipmap chain to the next surface */
5180 static DDSCAPS2 mipmap_caps = { DDSCAPS_MIPMAP | DDSCAPS_TEXTURE, 0, 0, {0} };
5181 IDirectDrawSurface7 *next_level;
5182 HRESULT hr;
5183
5184 hr = ddraw_surface7_GetAttachedSurface(&surface->IDirectDrawSurface7_iface, &mipmap_caps, &next_level);
5185 if (FAILED(hr)) return NULL;
5186
5187 ddraw_surface7_Release(next_level);
5188
5189 return impl_from_IDirectDrawSurface7(next_level);
5190}

Referenced by d3d_texture2_Load().

◆ impl_from_IDirectDrawGammaControl()

static struct ddraw_surface * impl_from_IDirectDrawGammaControl ( IDirectDrawGammaControl *  iface)
inlinestatic

Definition at line 34 of file surface.c.

35{
36 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawGammaControl_iface);
37}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by ddraw_gamma_control_AddRef(), ddraw_gamma_control_GetGammaRamp(), ddraw_gamma_control_QueryInterface(), ddraw_gamma_control_Release(), and ddraw_gamma_control_SetGammaRamp().

◆ surface_lock()

static HRESULT surface_lock ( struct ddraw_surface surface,
RECT rect,
DDSURFACEDESC2 surface_desc,
unsigned int  surface_desc_size,
DWORD  flags,
HANDLE  h 
)
static

Definition at line 956 of file surface.c.

959{
960 struct wined3d_map_desc map_desc;
961 struct wined3d_box box;
962 HRESULT hr = DD_OK;
963
964 TRACE("surface %p, rect %s, surface_desc %p, surface_desc_size %u, flags %#x, h %p.\n",
965 surface, wine_dbgstr_rect(rect), surface_desc, surface_desc_size, flags, h);
966
967 /* surface->surface_desc.dwWidth and dwHeight are changeable, thus lock */
969
970 /* Should I check for the handle to be NULL?
971 *
972 * The DDLOCK flags and the D3DLOCK flags are equal
973 * for the supported values. The others are ignored by WineD3D
974 */
975
976 /* Windows zeroes this if the rect is invalid */
977 surface_desc->lpSurface = NULL;
978
979 if (rect)
980 {
981 if ((rect->left < 0) || (rect->top < 0)
982 || (rect->left > rect->right) || (rect->right > surface->surface_desc.dwWidth)
983 || (rect->top > rect->bottom) || (rect->bottom > surface->surface_desc.dwHeight))
984 {
985 WARN("Trying to lock an invalid rectangle, returning DDERR_INVALIDPARAMS\n");
987 return DDERR_INVALIDPARAMS;
988 }
989 wined3d_box_set(&box, rect->left, rect->top, rect->right, rect->bottom, 0, 1);
990 }
991
994 if (SUCCEEDED(hr))
996 surface->sub_resource_idx, &map_desc, rect ? &box : NULL,
998 if (FAILED(hr))
999 {
1001 switch(hr)
1002 {
1003 /* D3D8 and D3D9 return the general D3DERR_INVALIDCALL error, but ddraw has a more
1004 * specific error. But since wined3d returns that error in this only occasion,
1005 * keep d3d8 and d3d9 free from the return value override. There are many different
1006 * places where d3d8/9 would have to catch the DDERR_SURFACEBUSY, it is much easier
1007 * to do it in one place in ddraw.
1008 */
1010 default: return hr;
1011 }
1012 }
1013
1015 {
1016 if (flags & DDLOCK_READONLY)
1017 SetRectEmpty(&surface->ddraw->primary_lock);
1018 else if (rect)
1019 surface->ddraw->primary_lock = *rect;
1020 else
1021 SetRect(&surface->ddraw->primary_lock, 0, 0, surface->surface_desc.dwWidth, surface->surface_desc.dwHeight);
1022 }
1023
1024 /* Windows does not set DDSD_LPSURFACE on locked surfaces. */
1025 DD_STRUCT_COPY_BYSIZE_(surface_desc, &surface->surface_desc, surface_desc_size, surface->surface_desc.dwSize);
1026 surface_desc->lpSurface = map_desc.data;
1027
1028 TRACE("locked surface returning description :\n");
1029 if (TRACE_ON(ddraw))
1030 DDRAW_dump_surface_desc(surface_desc);
1031
1033
1034 return DD_OK;
1035}
#define DD_STRUCT_COPY_BYSIZE_(to, from, to_size, from_size)
unsigned int wined3dmapflags_from_ddrawmapflags(unsigned int flags) DECLSPEC_HIDDEN
Definition: utils.c:564
HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
Definition: resource.c:344
#define DDLOCK_READONLY
Definition: ddraw.h:624
#define DDERR_SURFACEBUSY
Definition: ddraw.h:119
Definition: palette.c:468
static void wined3d_box_set(struct wined3d_box *box, unsigned int left, unsigned int top, unsigned int right, unsigned int bottom, unsigned int front, unsigned int back)
Definition: wined3d.h:2789

Referenced by ddraw_surface1_Lock(), ddraw_surface2_Lock(), ddraw_surface3_Lock(), ddraw_surface4_Lock(), and ddraw_surface7_Lock().

◆ surface_validate_lock_desc()

static BOOL surface_validate_lock_desc ( struct ddraw_surface surface,
const DDSURFACEDESC desc,
unsigned int size 
)
static

Definition at line 1037 of file surface.c.

1039{
1040 if (!desc)
1041 return FALSE;
1042
1043 if (desc->dwSize == sizeof(DDSURFACEDESC) || desc->dwSize == sizeof(DDSURFACEDESC2))
1044 {
1045 *size = desc->dwSize;
1046 return TRUE;
1047 }
1048
1049 if (surface->version == 7
1052 {
1053 if (desc->dwSize >= sizeof(DDSURFACEDESC2))
1054 *size = sizeof(DDSURFACEDESC2);
1055 else
1056 *size = sizeof(DDSURFACEDESC);
1057 return TRUE;
1058 }
1059
1060 WARN("Invalid structure size %u.\n", desc->dwSize);
1061 return FALSE;
1062}
void DDSURFACEDESC
Definition: amvideo.idl:25
struct _DDSURFACEDESC2 DDSURFACEDESC2

Referenced by ddraw_surface1_Lock(), ddraw_surface2_Lock(), ddraw_surface3_Lock(), ddraw_surface4_Lock(), and ddraw_surface7_Lock().

◆ unsafe_impl_from_IDirect3DTexture()

struct ddraw_surface * unsafe_impl_from_IDirect3DTexture ( IDirect3DTexture *  iface)

Definition at line 5728 of file surface.c.

5729{
5730 if (!iface) return NULL;
5731 assert(iface->lpVtbl == &d3d_texture1_vtbl);
5732 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirect3DTexture_iface);
5733}
#define assert(x)
Definition: debug.h:53

Referenced by d3d_device1_SwapTextureHandles(), and d3d_texture1_Load().

◆ unsafe_impl_from_IDirect3DTexture2()

struct ddraw_surface * unsafe_impl_from_IDirect3DTexture2 ( IDirect3DTexture2 *  iface)

Definition at line 5721 of file surface.c.

5722{
5723 if (!iface) return NULL;
5724 assert(iface->lpVtbl == &d3d_texture2_vtbl);
5725 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirect3DTexture2_iface);
5726}

Referenced by d3d_device2_SwapTextureHandles(), d3d_device3_SetTexture(), and d3d_texture2_Load().

◆ unsafe_impl_from_IDirectDrawSurface()

struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface ( IDirectDrawSurface *  iface)

Definition at line 5705 of file surface.c.

5706{
5707 if (!iface) return NULL;
5708 if (iface->lpVtbl != &ddraw_surface1_vtbl)
5709 {
5710 HRESULT hr = IDirectDrawSurface_QueryInterface(iface, &IID_IDirectDrawSurface, (void **)&iface);
5711 if (FAILED(hr))
5712 {
5713 WARN("Object %p doesn't expose interface IDirectDrawSurface.\n", iface);
5714 return NULL;
5715 }
5716 IDirectDrawSurface_Release(iface);
5717 }
5718 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface_iface);
5719}

Referenced by d3d2_CreateDevice(), d3d_device2_SetRenderTarget(), ddraw1_DuplicateSurface(), ddraw2_DuplicateSurface(), ddraw_surface1_AddAttachedSurface(), ddraw_surface1_Blt(), ddraw_surface1_BltFast(), ddraw_surface1_DeleteAttachedSurface(), ddraw_surface1_Flip(), ddraw_surface1_UpdateOverlay(), and ddraw_surface1_UpdateOverlayZOrder().

◆ unsafe_impl_from_IDirectDrawSurface2()

static struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface2 ( IDirectDrawSurface2 *  iface)
static

Definition at line 5689 of file surface.c.

5690{
5691 if (!iface) return NULL;
5692 if (iface->lpVtbl != &ddraw_surface2_vtbl)
5693 {
5694 HRESULT hr = IDirectDrawSurface2_QueryInterface(iface, &IID_IDirectDrawSurface2, (void **)&iface);
5695 if (FAILED(hr))
5696 {
5697 WARN("Object %p doesn't expose interface IDirectDrawSurface2.\n", iface);
5698 return NULL;
5699 }
5700 IDirectDrawSurface2_Release(iface);
5701 }
5702 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface2_iface);
5703}

Referenced by ddraw_surface2_AddAttachedSurface(), ddraw_surface2_Blt(), ddraw_surface2_BltFast(), ddraw_surface2_DeleteAttachedSurface(), ddraw_surface2_Flip(), ddraw_surface2_UpdateOverlay(), and ddraw_surface2_UpdateOverlayZOrder().

◆ unsafe_impl_from_IDirectDrawSurface3()

static struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface3 ( IDirectDrawSurface3 *  iface)
static

Definition at line 5673 of file surface.c.

5674{
5675 if (!iface) return NULL;
5676 if (iface->lpVtbl != &ddraw_surface3_vtbl)
5677 {
5678 HRESULT hr = IDirectDrawSurface3_QueryInterface(iface, &IID_IDirectDrawSurface3, (void **)&iface);
5679 if (FAILED(hr))
5680 {
5681 WARN("Object %p doesn't expose interface IDirectDrawSurface3.\n", iface);
5682 return NULL;
5683 }
5684 IDirectDrawSurface3_Release(iface);
5685 }
5686 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface3_iface);
5687}

Referenced by ddraw_surface3_AddAttachedSurface(), ddraw_surface3_Blt(), ddraw_surface3_BltFast(), ddraw_surface3_DeleteAttachedSurface(), ddraw_surface3_Flip(), ddraw_surface3_UpdateOverlay(), and ddraw_surface3_UpdateOverlayZOrder().

◆ unsafe_impl_from_IDirectDrawSurface4()

struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface4 ( IDirectDrawSurface4 *  iface)

Definition at line 5657 of file surface.c.

5658{
5659 if (!iface) return NULL;
5660 if (iface->lpVtbl != &ddraw_surface4_vtbl)
5661 {
5662 HRESULT hr = IDirectDrawSurface4_QueryInterface(iface, &IID_IDirectDrawSurface4, (void **)&iface);
5663 if (FAILED(hr))
5664 {
5665 WARN("Object %p doesn't expose interface IDirectDrawSurface4.\n", iface);
5666 return NULL;
5667 }
5668 IDirectDrawSurface4_Release(iface);
5669 }
5670 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface4_iface);
5671}

Referenced by d3d3_CreateDevice(), d3d_device3_SetRenderTarget(), ddraw4_DuplicateSurface(), ddraw_surface4_AddAttachedSurface(), ddraw_surface4_Blt(), ddraw_surface4_BltFast(), ddraw_surface4_DeleteAttachedSurface(), ddraw_surface4_Flip(), ddraw_surface4_UpdateOverlay(), and ddraw_surface4_UpdateOverlayZOrder().

◆ unsafe_impl_from_IDirectDrawSurface7()

struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface7 ( IDirectDrawSurface7 iface)

Definition at line 5641 of file surface.c.

5642{
5643 if (!iface) return NULL;
5644 if (iface->lpVtbl != &ddraw_surface7_vtbl)
5645 {
5646 HRESULT hr = IDirectDrawSurface7_QueryInterface(iface, &IID_IDirectDrawSurface7, (void **)&iface);
5647 if (FAILED(hr))
5648 {
5649 WARN("Object %p doesn't expose interface IDirectDrawSurface7.\n", iface);
5650 return NULL;
5651 }
5652 IDirectDrawSurface7_Release(iface);
5653 }
5654 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface7_iface);
5655}

Referenced by copy_mipmap_chain(), d3d7_CreateDevice(), d3d_device3_GetTexture(), d3d_device7_Load(), d3d_device7_PreLoad(), d3d_device7_SetRenderTarget(), d3d_device7_SetTexture(), ddraw7_DuplicateSurface(), ddraw7_EnumSurfaces(), ddraw_surface7_AddAttachedSurface(), ddraw_surface7_Blt(), ddraw_surface7_BltFast(), ddraw_surface7_DeleteAttachedSurface(), ddraw_surface7_Flip(), ddraw_surface7_UpdateOverlay(), and is_mip_level_subset().

◆ view_wined3d_object_destroyed()

static void STDMETHODCALLTYPE view_wined3d_object_destroyed ( void parent)
static

Definition at line 6499 of file surface.c.

6500{
6501 struct ddraw_surface *surface = parent;
6502
6503 /* If the surface reference count drops to zero, we release our reference
6504 * to the view, but don't clear the pointer yet, in case e.g. a
6505 * GetRenderTarget() call brings the surface back before the view is
6506 * actually destroyed. When the view is destroyed, we need to clear the
6507 * pointer, or a subsequent surface AddRef() would reference it again.
6508 *
6509 * This is safe because as long as the view still has a reference to the
6510 * texture, the surface is also still alive, and we're called before the
6511 * view releases that reference. */
6512 surface->wined3d_rtv = NULL;
6513}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ddraw  )

Variable Documentation

◆ d3d_texture1_vtbl

const struct IDirect3DTextureVtbl d3d_texture1_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI d3d_texture1_Initialize(IDirect3DTexture *iface, IDirect3DDevice *device, IDirectDrawSurface *surface)
Definition: surface.c:3594
static ULONG WINAPI d3d_texture1_AddRef(IDirect3DTexture *iface)
Definition: surface.c:440
static HRESULT WINAPI d3d_texture1_PaletteChanged(IDirect3DTexture *iface, DWORD start, DWORD count)
Definition: surface.c:5087
static ULONG WINAPI d3d_texture1_Release(IDirect3DTexture *iface)
Definition: surface.c:700
static HRESULT WINAPI d3d_texture1_Load(IDirect3DTexture *iface, IDirect3DTexture *src_texture)
Definition: surface.c:5344
static HRESULT WINAPI d3d_texture1_Unload(IDirect3DTexture *iface)
Definition: surface.c:5106
static HRESULT WINAPI d3d_texture1_QueryInterface(IDirect3DTexture *iface, REFIID riid, void **object)
Definition: surface.c:306
static HRESULT WINAPI d3d_texture1_GetHandle(IDirect3DTexture *iface, IDirect3DDevice *device, D3DTEXTUREHANDLE *handle)
Definition: surface.c:5157

Definition at line 5627 of file surface.c.

Referenced by ddraw_surface_init(), and unsafe_impl_from_IDirect3DTexture().

◆ d3d_texture2_vtbl

const struct IDirect3DTexture2Vtbl d3d_texture2_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI d3d_texture2_Release(IDirect3DTexture2 *iface)
Definition: surface.c:691
static ULONG WINAPI d3d_texture2_AddRef(IDirect3DTexture2 *iface)
Definition: surface.c:431
static HRESULT WINAPI d3d_texture2_QueryInterface(IDirect3DTexture2 *iface, REFIID riid, void **object)
Definition: surface.c:297

Definition at line 5617 of file surface.c.

Referenced by ddraw_surface_init(), and unsafe_impl_from_IDirect3DTexture2().

◆ ddraw_gamma_control_vtbl

const struct IDirectDrawGammaControlVtbl ddraw_gamma_control_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI ddraw_gamma_control_Release(IDirectDrawGammaControl *iface)
Definition: surface.c:676
static ULONG WINAPI ddraw_gamma_control_AddRef(IDirectDrawGammaControl *iface)
Definition: surface.c:416
static HRESULT WINAPI ddraw_gamma_control_SetGammaRamp(IDirectDrawGammaControl *iface, DWORD flags, DDGAMMARAMP *gamma_ramp)
Definition: surface.c:5038
static HRESULT WINAPI ddraw_gamma_control_QueryInterface(IDirectDrawGammaControl *iface, REFIID riid, void **object)
Definition: surface.c:287
static HRESULT WINAPI ddraw_gamma_control_GetGammaRamp(IDirectDrawGammaControl *iface, DWORD flags, DDGAMMARAMP *gamma_ramp)
Definition: surface.c:4996

Definition at line 5608 of file surface.c.

Referenced by ddraw_surface_init().

◆ ddraw_surface1_vtbl

struct IDirectDrawSurfaceVtbl ddraw_surface1_vtbl
static

Definition at line 5566 of file surface.c.

Referenced by ddraw_surface_init(), and unsafe_impl_from_IDirectDrawSurface().

◆ ddraw_surface2_vtbl

const struct IDirectDrawSurface2Vtbl ddraw_surface2_vtbl
static

Definition at line 5520 of file surface.c.

Referenced by ddraw_surface_init(), and unsafe_impl_from_IDirectDrawSurface2().

◆ ddraw_surface3_vtbl

const struct IDirectDrawSurface3Vtbl ddraw_surface3_vtbl
static

Definition at line 5472 of file surface.c.

Referenced by ddraw_surface_init(), and unsafe_impl_from_IDirectDrawSurface3().

◆ ddraw_surface4_vtbl

const struct IDirectDrawSurface4Vtbl ddraw_surface4_vtbl
static

Definition at line 5418 of file surface.c.

Referenced by ddraw_surface_init(), and unsafe_impl_from_IDirectDrawSurface4().

◆ ddraw_surface7_vtbl

const struct IDirectDrawSurface7Vtbl ddraw_surface7_vtbl
static

Definition at line 5359 of file surface.c.

Referenced by ddraw_surface_init(), and unsafe_impl_from_IDirectDrawSurface7().

◆ ddraw_surface_wined3d_parent_ops

const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops
static
Initial value:
=
{
}
static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *parent)
Definition: surface.c:5735

Definition at line 5769 of file surface.c.

Referenced by ddraw_surface_init().

◆ ddraw_texture_wined3d_parent_ops

const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops
static
Initial value:
=
{
}
static void STDMETHODCALLTYPE ddraw_texture_wined3d_object_destroyed(void *parent)
Definition: surface.c:5774

Definition at line 5781 of file surface.c.

Referenced by ddraw_surface_create().

◆ ddraw_view_wined3d_parent_ops

const struct wined3d_parent_ops ddraw_view_wined3d_parent_ops
static
Initial value:
=
{
}
static void STDMETHODCALLTYPE view_wined3d_object_destroyed(void *parent)
Definition: surface.c:340

Definition at line 6515 of file surface.c.

Referenced by ddraw_surface_get_rendertarget_view().