Ziqing Hui : windowscodecs: Implement DdsFrameDecode_Dds_GetSizeInBlocks().
Alexandre Julliard
julliard at winehq.org
Mon Jun 1 15:14:56 CDT 2020
Module: wine
Branch: master
Commit: a31cadae42293a4c0da7553d4a00533c8c63c437
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a31cadae42293a4c0da7553d4a00533c8c63c437
Author: Ziqing Hui <zhui at codeweavers.com>
Date: Mon Jun 1 12:59:48 2020 +0800
windowscodecs: Implement DdsFrameDecode_Dds_GetSizeInBlocks().
Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
Signed-off-by: Esme Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/windowscodecs/ddsformat.c | 15 +++++++++++++--
dlls/windowscodecs/tests/ddsformat.c | 8 ++++----
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/dlls/windowscodecs/ddsformat.c b/dlls/windowscodecs/ddsformat.c
index 7b0817e738..ce6cb9794c 100644
--- a/dlls/windowscodecs/ddsformat.c
+++ b/dlls/windowscodecs/ddsformat.c
@@ -112,6 +112,8 @@ typedef struct dds_frame_info {
UINT bytes_per_block;
UINT block_width;
UINT block_height;
+ UINT width_in_blocks;
+ UINT height_in_blocks;
} dds_frame_info;
typedef struct DdsDecoder {
@@ -432,9 +434,16 @@ static ULONG WINAPI DdsFrameDecode_Dds_Release(IWICDdsFrameDecode *iface)
static HRESULT WINAPI DdsFrameDecode_Dds_GetSizeInBlocks(IWICDdsFrameDecode *iface,
UINT *widthInBlocks, UINT *heightInBlocks)
{
- FIXME("(%p,%p,%p): stub.\n", iface, widthInBlocks, heightInBlocks);
+ DdsFrameDecode *This = impl_from_IWICDdsFrameDecode(iface);
- return E_NOTIMPL;
+ if (!widthInBlocks || !heightInBlocks) return E_INVALIDARG;
+
+ *widthInBlocks = This->info.width_in_blocks;
+ *heightInBlocks = This->info.height_in_blocks;
+
+ TRACE("(%p,%p,%p) -> (%d,%d)\n", iface, widthInBlocks, heightInBlocks, *widthInBlocks, *heightInBlocks);
+
+ return S_OK;
}
static HRESULT WINAPI DdsFrameDecode_Dds_GetFormatInfo(IWICDdsFrameDecode *iface,
@@ -839,6 +848,8 @@ static HRESULT WINAPI DdsDecoder_Dds_GetFrame(IWICDdsDecoder *iface,
frame_decode->info.bytes_per_block = get_bytes_per_block(This->info.format);
frame_decode->info.block_width = 4;
frame_decode->info.block_height = 4;
+ frame_decode->info.width_in_blocks = (width + frame_decode->info.block_width - 1) / frame_decode->info.block_width;
+ frame_decode->info.height_in_blocks = (width + frame_decode->info.block_height - 1) / frame_decode->info.block_height;
*bitmapFrame = &frame_decode->IWICBitmapFrameDecode_iface;
hr = S_OK;
diff --git a/dlls/windowscodecs/tests/ddsformat.c b/dlls/windowscodecs/tests/ddsformat.c
index d1f9b40ff2..9b14bed52c 100644
--- a/dlls/windowscodecs/tests/ddsformat.c
+++ b/dlls/windowscodecs/tests/ddsformat.c
@@ -456,13 +456,13 @@ static void test_dds_decoder_frame_properties(IWICBitmapDecoder *decoder, IWICBi
/* size in blocks tests */
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, NULL, NULL);
- todo_wine ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
+ ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, NULL, &height_in_blocks);
- todo_wine ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
+ ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, NULL);
- todo_wine ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
+ ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, &height_in_blocks);
- todo_wine ok (hr == S_OK, "%d: [frame %d] GetSizeInBlocks failed, hr=%x\n", i, frame_index, hr);
+ ok (hr == S_OK, "%d: [frame %d] GetSizeInBlocks failed, hr=%x\n", i, frame_index, hr);
if (hr != S_OK) goto end;
expected_width_in_blocks = (expected_width + format_info.BlockWidth - 1) / format_info.BlockWidth;
More information about the wine-cvs
mailing list