On Mon, Jan 11, 2016 at 10:46 AM, Alistair Leslie-Hughes <
leslie_alistair@hotmail.com> wrote:
dlls/d3dx9_36/tests/surface.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c
index 183086f..5a20658 100644
--- a/dlls/d3dx9_36/tests/surface.c
+++ b/dlls/d3dx9_36/tests/surface.c
@@ -200,7 +200,6 @@ struct dds_pixel_format
struct dds_header
{
- DWORD magic;
DWORD size;
DWORD flags;
DWORD height;
@@ -222,7 +221,6 @@ static void fill_dds_header(struct dds_header *header)
{
memset(header, 0, sizeof(*header));
- header->magic = MAKEFOURCC('D','D','S',' ');
header->size = sizeof(*header);
header->flags = DDS_CAPS | DDS_WIDTH | DDS_HEIGHT | DDS_PIXELFORMAT;
header->height = 4;
@@ -250,10 +248,12 @@ static void check_dds_pixel_format_(unsigned int
line,
D3DXIMAGE_INFO info;
struct
{
DWORD magic;
struct dds_header header;
BYTE data[256];
} dds;
dds.magic = MAKEFOURCC('D','D','S',' ');
fill_dds_header(&dds.header);
dds.header.pixel_format.flags = flags;
dds.header.pixel_format.fourcc = fourcc;
@@ -281,6 +281,7 @@ static void test_dds_header_handling(void)
D3DXIMAGE_INFO info;
struct
{
@@ -399,9 +400,10 @@ static void test_dds_header_handling(void)
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
{
tests[i].pixel_data_size;
assert(file_size <= sizeof(*dds));
dds->magic = MAKEFOURCC('D','D','S',' ');
fill_dds_header(&dds->header);
dds->header.flags |= tests[i].flags;
dds->header.width = tests[i].width;
@@ -1235,6 +1237,7 @@ static void
test_D3DXSaveSurfaceToFileInMemory(IDirect3DDevice9 *device)
ID3DXBuffer *buffer;
IDirect3DSurface9 *surface;
struct dds_header *header;
D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &surface, NULL);
if (FAILED(hr)) {
@@ -1257,9 +1260,10 @@ static void
test_D3DXSaveSurfaceToFileInMemory(IDirect3DDevice9 *device)
todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
if (SUCCEEDED(hr))
{
ok(header->magic == MAKEFOURCC('D','D','S',' '), "Invalid DDS
signature.\n");
ok( *(DWORD*)data == MAKEFOURCC('D','D','S',' '), "Invalid DDS
signature.\n");
ok(header->size == 124, "Invalid DDS size %u.\n", header->size);
ok(!header->height, "Got unexpected height %u.\n",
header->height);
ok(!header->width, "Got unexpected width %u.\n", header->width);
@@ -1274,9 +1278,10 @@ static void
test_D3DXSaveSurfaceToFileInMemory(IDirect3DDevice9 *device)
hr = D3DXSaveSurfaceToFileInMemory(&buffer, D3DXIFF_DDS, surface,
NULL, NULL);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
header = ID3DXBuffer_GetBufferPointer(buffer);
ok(header->magic == MAKEFOURCC('D','D','S',' '), "Invalid DDS
signature.\n");
- data = ID3DXBuffer_GetBufferPointer(buffer);
- header = (struct dds_header *)(data + sizeof(DWORD));
- ok( *(DWORD*)data == MAKEFOURCC('D','D','S',' '), "Invalid DDS
signature.\n");
ok(header->size == 124, "Invalid DDS size %u.\n", header->size);
ok(header->height == 4, "Got unexpected height %u.\n",
header->height);
ok(header->width == 4, "Got unexpected width %u.\n", header->width);
--
2.6.4
What's the point of this change? It doesn't fix anything and doesn't make
code more readable. If the file signature isn't included in the DDS header
size it doesn't necessarily mean we have to move it out of struct
dds_header.