msvfw32-ICGetDisplayFormat: Update patchset and fix initialization of biSizeImage field.

This commit is contained in:
Sebastian Lackner 2016-04-02 16:26:08 +02:00
parent 8cc2c511dd
commit 8b8f5b3b8c
3 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,95 @@
From cd04ddddb9d9fcf5011b49320682fefb0b7a28c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 2 Apr 2016 16:13:44 +0200
Subject: msvfw32: Set biSizeImage correctly in ICGetDisplayFormat.
---
dlls/msvfw32/msvideo_main.c | 4 +++-
dlls/msvfw32/tests/msvfw.c | 15 +++++++++++----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c
index 41bd234..6f91859 100644
--- a/dlls/msvfw32/msvideo_main.c
+++ b/dlls/msvfw32/msvideo_main.c
@@ -761,7 +761,6 @@ HIC VFWAPI ICGetDisplayFormat(
lpbiOut->biWidth = dx;
lpbiOut->biHeight = dy;
lpbiOut->biPlanes = 1;
- lpbiOut->biSizeImage = 0;
for (i = 0; i < sizeof(try_depths) / sizeof(try_depths[0]); i++)
{
@@ -771,6 +770,7 @@ HIC VFWAPI ICGetDisplayFormat(
found = TRUE;
lpbiOut->biBitCount = try_depths[i].depth;
lpbiOut->biCompression = try_depths[i].compression;
+ lpbiOut->biSizeImage = dx * dy * lpbiOut->biBitCount / 8;
if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
goto success;
@@ -780,11 +780,13 @@ HIC VFWAPI ICGetDisplayFormat(
{
lpbiOut->biBitCount = depth;
lpbiOut->biCompression = BI_RGB;
+ lpbiOut->biSizeImage = (dx * dy * depth) / 8;
if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
goto success;
lpbiOut->biBitCount = screen_depth;
lpbiOut->biCompression = BI_RGB;
+ lpbiOut->biSizeImage = dx * dy * screen_depth / 8;
if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
goto success;
}
diff --git a/dlls/msvfw32/tests/msvfw.c b/dlls/msvfw32/tests/msvfw.c
index 36dec1d..252aba2 100644
--- a/dlls/msvfw32/tests/msvfw.c
+++ b/dlls/msvfw32/tests/msvfw.c
@@ -429,9 +429,12 @@ LRESULT WINAPI driver_proc_test(DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg,
"Expected biBitCount %d, got %d\n", expected->bits, out->biBitCount);
ok(out->biCompression == expected->compression,
"Expected compression %d, got %d\n", expected->compression, out->biCompression);
+ ok(out->biSizeImage == (out->biWidth * out->biHeight * out->biBitCount) / 8,
+ "Expected biSizeImage %d, got %d\n", (out->biWidth * out->biHeight * out->biBitCount) / 8,
+ out->biSizeImage);
- trace("query -> width: %d, height: %d, bit: %d, compression: %d\n",
- out->biWidth, out->biHeight, out->biBitCount, out->biCompression);
+ trace("query -> width: %d, height: %d, bit: %d, compression: %d, size: %d\n",
+ out->biWidth, out->biHeight, out->biBitCount, out->biCompression, out->biSizeImage);
break;
}
@@ -456,8 +459,8 @@ LRESULT WINAPI driver_proc_test(DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg,
ok(out->biCompression == expected->compression,
"Expected compression %d, got %d\n", expected->compression, out->biCompression);
- trace("format -> width: %d, height: %d, bit: %d, compression: %d\n",
- out->biWidth, out->biHeight, out->biBitCount, out->biCompression);
+ trace("format -> width: %d, height: %d, bit: %d, compression: %d, size: %d\n",
+ out->biWidth, out->biHeight, out->biBitCount, out->biCompression, out->biSizeImage);
out->biBitCount = 64;
break;
@@ -498,6 +501,7 @@ void test_ICGetDisplayFormat(void)
HIC ic, ic2;
BITMAPINFOHEADER in;
BITMAPINFOHEADER out;
+ int real_depth;
int i;
ic = ICOpenFunction(ICTYPE_VIDEO, 0xdeadbeef, ICMODE_DECOMPRESS, driver_proc_test);
@@ -529,6 +533,9 @@ void test_ICGetDisplayFormat(void)
"Expected biWidth %d, got %d\n", tests[i].width_expected, out.biWidth);
ok(out.biHeight == tests[i].height_expected,
"Expected biHeight %d, got %d\n", tests[i].height_expected, out.biHeight);
+ real_depth = (out.biBitCount > 32) ? 4 : out.biBitCount / 8;
+ ok(out.biSizeImage == out.biWidth * out.biHeight * real_depth,
+ "Expected biSizeImage %d, got %d\n", out.biWidth * out.biHeight * real_depth, out.biSizeImage);
ok(msg_index == tests[i].msg_index,
"Expected msg_index %d, got %d\n", tests[i].msg_index, msg_index);
}
--
2.7.1

View File

@ -1 +1,2 @@
Fixes: [23175] Fix implementation of ICGetDisplayFormat
Fixes: [25180] Fix rendering of Clonk Endeavour's intro video

View File

@ -4582,6 +4582,7 @@ fi
# |
# | This patchset fixes the following Wine bugs:
# | * [#23175] Fix implementation of ICGetDisplayFormat
# | * [#25180] Fix rendering of Clonk Endeavour's intro video
# |
# | Modified files:
# | * dlls/msvfw32/msvideo_main.c, dlls/msvfw32/tests/msvfw.c
@ -4589,9 +4590,11 @@ fi
if test "$enable_msvfw32_ICGetDisplayFormat" -eq 1; then
patch_apply msvfw32-ICGetDisplayFormat/0001-msvfw32-Try-different-formarts-in-ICGetDisplayFormat.patch
patch_apply msvfw32-ICGetDisplayFormat/0002-msvfw32-Add-test-for-negative-width-height-values-pa.patch
patch_apply msvfw32-ICGetDisplayFormat/0003-msvfw32-Set-biSizeImage-correctly-in-ICGetDisplayFor.patch
(
echo '+ { "Michael Müller", "msvfw32: Try different formarts in ICGetDisplayFormat.", 1 },';
echo '+ { "Michael Müller", "msvfw32: Add test for negative width/height values passed to ICGetDisplayFormat.", 1 },';
echo '+ { "Michael Müller", "msvfw32: Set biSizeImage correctly in ICGetDisplayFormat.", 1 },';
) >> "$patchlist"
fi