Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/main.c | 15 +++++++++++++-- dlls/mfplat/tests/mfplat.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 94d5ab0f48..21240dfbeb 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -476,10 +476,21 @@ HRESULT WINAPI MFUnlockPlatform(void) return S_OK; }
+/*********************************************************************** + * MFCopyImage (mfplat.@) + */ HRESULT WINAPI MFCopyImage(BYTE *dest, LONG deststride, const BYTE *src, LONG srcstride, DWORD width, DWORD lines) { - FIXME("(%p, %d, %p, %d, %d, %d) stub\n", dest, deststride, src, srcstride, width, lines); - return E_NOTIMPL; + TRACE("(%p, %d, %p, %d, %u, %u)\n", dest, deststride, src, srcstride, width, lines); + + while (lines--) + { + memcpy(dest, src, width); + dest += deststride; + src += srcstride; + } + + return S_OK; }
typedef struct _mfattributes diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 8b06e23375..7d319b480d 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -877,6 +877,40 @@ static void test_allocate_queue(void) ok(hr == S_OK, "Failed to shutdown, hr %#x.\n", hr); }
+static void test_MFCopyImage(void) +{ + BYTE dest[16], src[16]; + HRESULT hr; + + memset(dest, 0xaa, sizeof(dest)); + memset(src, 0x11, sizeof(src)); + + hr = MFCopyImage(dest, 8, src, 8, 4, 1); + ok(hr == S_OK, "Failed to copy image %#x.\n", hr); + ok(!memcmp(dest, src, 4) && dest[4] == 0xaa, "Unexpected buffer contents.\n"); + + memset(dest, 0xaa, sizeof(dest)); + memset(src, 0x11, sizeof(src)); + + hr = MFCopyImage(dest, 8, src, 8, 16, 1); + ok(hr == S_OK, "Failed to copy image %#x.\n", hr); + ok(!memcmp(dest, src, 16), "Unexpected buffer contents.\n"); + + memset(dest, 0xaa, sizeof(dest)); + memset(src, 0x11, sizeof(src)); + + hr = MFCopyImage(dest, 8, src, 8, 8, 2); + ok(hr == S_OK, "Failed to copy image %#x.\n", hr); + ok(!memcmp(dest, src, 16), "Unexpected buffer contents.\n"); + + memset(dest, 0xaa, sizeof(dest)); + memset(src, 0x11, sizeof(src)); + + hr = MFCopyImage(dest, 8, src, 8, 8, 0); + ok(hr == S_OK, "Failed to copy image %#x.\n", hr); + ok(dest[0] == 0xaa, "Unexpected buffer contents.\n"); +} + START_TEST(mfplat) { CoInitialize(NULL); @@ -895,6 +929,7 @@ START_TEST(mfplat) test_source_resolver(); test_MFCreateAsyncResult(); test_allocate_queue(); + test_MFCopyImage();
CoUninitialize(); }