mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 07:37:02 +00:00
ddraw: Don't interpret end padding as dwCaps2 for x64.
This commit is contained in:
parent
3871329872
commit
f7002c6627
3 changed files with 18 additions and 7 deletions
|
@ -3125,8 +3125,7 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD,
|
|||
DDSD->ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL;
|
||||
|
||||
/* Modify some flags */
|
||||
desc2.dwSize = sizeof(desc2); /* For the struct copy */
|
||||
DD_STRUCT_COPY_BYSIZE(&desc2, DDSD);
|
||||
copy_to_surfacedesc2(&desc2, DDSD);
|
||||
desc2.u4.ddpfPixelFormat.dwSize=sizeof(DDPIXELFORMAT); /* Just to be sure */
|
||||
|
||||
/* Get the video mode from WineD3D - we will need it */
|
||||
|
|
|
@ -588,16 +588,30 @@ typedef struct
|
|||
/* Structure copy */
|
||||
#define ME(x,f,e) { x, #x, (void (*)(const void *))(f), offsetof(STRUCT, e) }
|
||||
|
||||
#define DD_STRUCT_COPY_BYSIZE(to,from) \
|
||||
#define DD_STRUCT_COPY_BYSIZE_(to,from,from_size) \
|
||||
do { \
|
||||
DWORD __size = (to)->dwSize; \
|
||||
DWORD __copysize = min(__size, (from)->dwSize); \
|
||||
DWORD __copysize = min(__size, from_size); \
|
||||
assert(to != from); \
|
||||
memcpy(to, from, __copysize); \
|
||||
memset((char*)(to) + __copysize, 0, __size - __copysize); \
|
||||
(to)->dwSize = __size; /* restore size */ \
|
||||
} while (0)
|
||||
|
||||
#define DD_STRUCT_COPY_BYSIZE(to,from) DD_STRUCT_COPY_BYSIZE_(to,from,(from)->dwSize)
|
||||
|
||||
#define SIZEOF_END_PADDING(type, last_field) \
|
||||
(sizeof(type) - offsetof(type, last_field) - sizeof(((type *)0)->last_field))
|
||||
|
||||
static inline void copy_to_surfacedesc2(DDSURFACEDESC2 *to, DDSURFACEDESC2 *from)
|
||||
{
|
||||
DWORD from_size = from->dwSize;
|
||||
if (from_size == sizeof(DDSURFACEDESC))
|
||||
from_size -= SIZEOF_END_PADDING(DDSURFACEDESC, ddsCaps);
|
||||
to->dwSize = sizeof(DDSURFACEDESC2); /* for struct copy */
|
||||
DD_STRUCT_COPY_BYSIZE_(to, from, from_size);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -3565,9 +3565,7 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
|
|||
surface->version = 7;
|
||||
surface->ddraw = ddraw;
|
||||
|
||||
surface->surface_desc.dwSize = sizeof(DDSURFACEDESC2);
|
||||
surface->surface_desc.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
|
||||
DD_STRUCT_COPY_BYSIZE(&surface->surface_desc, desc);
|
||||
copy_to_surfacedesc2(&surface->surface_desc, desc);
|
||||
|
||||
surface->first_attached = surface;
|
||||
surface->ImplType = surface_type;
|
||||
|
|
Loading…
Reference in a new issue