Skip to content

Commit 1e03e9c

Browse files
committed
add bpp check to dds blt
1 parent ca195bc commit 1e03e9c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

inc/IDirectDrawSurface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ typedef struct IDirectDrawSurfaceImpl
2323

2424
ULONG ref;
2525

26+
DWORD bpp;
2627
DWORD width;
2728
DWORD height;
28-
DWORD bpp;
2929
DWORD size;
3030
DWORD flags;
3131
DWORD caps;

src/ddsurface.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ HRESULT dds_Blt(
5050
DWORD dwFlags,
5151
LPDDBLTFX lpDDBltFx)
5252
{
53+
if (lpDDSrcSurface &&
54+
lpDDSrcSurface->bpp != 8 &&
55+
lpDDSrcSurface->bpp != 16 &&
56+
lpDDSrcSurface->bpp != 24 &&
57+
lpDDSrcSurface->bpp != 32)
58+
{
59+
return DDERR_INVALIDPARAMS;
60+
}
61+
5362
dbg_dump_dds_blt_flags(dwFlags);
5463
dbg_dump_dds_blt_fx_flags((dwFlags & DDBLT_DDFX) && lpDDBltFx ? lpDDBltFx->dwDDFX : 0);
5564

@@ -77,13 +86,13 @@ HRESULT dds_Blt(
7786

7887
if (lpSrcRect && src_surface)
7988
{
80-
//dbg_print_rect("lpSrcRect", lpSrcRect);
89+
dbg_print_rect("lpSrcRect", lpSrcRect);
8190
src_rect = *lpSrcRect;
8291
}
8392

8493
if (lpDestRect)
8594
{
86-
//dbg_print_rect("lpDestRect", lpDestRect);
95+
dbg_print_rect("lpDestRect", lpDestRect);
8796
dst_rect = *lpDestRect;
8897
}
8998

0 commit comments

Comments
 (0)