Commit b7fe6359 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

mfplat/buffer: Do not flip in memory_2d_buffer_ContiguousCopy{From|To}().

parent 8487666e
......@@ -626,7 +626,10 @@ static HRESULT WINAPI memory_2d_buffer_ContiguousCopyTo(IMF2DBuffer2 *iface, BYT
if (SUCCEEDED(hr))
{
copy_image(buffer, dest_buffer, buffer->_2d.width, src_scanline0, src_pitch, buffer->_2d.width, buffer->_2d.height);
if (src_pitch < 0)
src_pitch = -src_pitch;
copy_image(buffer, dest_buffer, buffer->_2d.width, src_buffer_start, src_pitch,
buffer->_2d.width, buffer->_2d.height);
if (FAILED(IMF2DBuffer2_Unlock2D(iface)))
WARN("Couldn't unlock source buffer %p, hr %#lx.\n", iface, hr);
......@@ -652,7 +655,10 @@ static HRESULT WINAPI memory_2d_buffer_ContiguousCopyFrom(IMF2DBuffer2 *iface, c
if (SUCCEEDED(hr))
{
copy_image(buffer, dst_scanline0, dst_pitch, src_buffer, buffer->_2d.width, buffer->_2d.width, buffer->_2d.height);
if (dst_pitch < 0)
dst_pitch = -dst_pitch;
copy_image(buffer, dst_buffer_start, dst_pitch, src_buffer, buffer->_2d.width,
buffer->_2d.width, buffer->_2d.height);
if (FAILED(IMF2DBuffer2_Unlock2D(iface)))
WARN("Couldn't unlock destination buffer %p, hr %#lx.\n", iface, hr);
......
......@@ -9506,9 +9506,9 @@ static void test_MFCreatePathFromURL(void)
}
}
#define check_reset_data(a, b, c, d, e, f) check_reset_data_(__LINE__, a, b, c, d, e, f)
#define check_reset_data(a, b, c, d, e) check_reset_data_(__LINE__, a, b, c, d, e)
static void check_reset_data_(unsigned int line, IMF2DBuffer2 *buffer2d, const BYTE *data, BOOL bottom_up,
DWORD width, DWORD height, BOOL todo)
DWORD width, DWORD height)
{
BYTE *scanline0, *buffer_start;
DWORD length, max_length;
......@@ -9534,7 +9534,7 @@ static void check_reset_data_(unsigned int line, IMF2DBuffer2 *buffer2d, const B
ok(buffer_start == scanline0, "buffer start mismatch.\n");
}
for (i = 0; i < height; ++i)
todo_wine_if(bottom_up && todo) ok_(__FILE__,line)(!memcmp(buffer_start + abs(pitch) * i, data + width * i * 4, width * 4),
ok_(__FILE__,line)(!memcmp(buffer_start + abs(pitch) * i, data + width * i * 4, width * 4),
"2D Data mismatch, scaline %d.\n", i);
hr = IMF2DBuffer2_Unlock2D(buffer2d);
ok(hr == S_OK, "got hr %#lx.\n", hr);
......@@ -9543,7 +9543,7 @@ static void check_reset_data_(unsigned int line, IMF2DBuffer2 *buffer2d, const B
ok(hr == S_OK, "got hr %#lx.\n", hr);
ok_(__FILE__,line)(max_length == width * height * 4, "got max_length %lu.\n", max_length);
ok_(__FILE__,line)(length == width * height * 4, "got length %lu.\n", length);
todo_wine_if(bottom_up && todo) ok_(__FILE__,line)(!memcmp(lock, data, length), "contiguous data mismatch.\n");
ok_(__FILE__,line)(!memcmp(lock, data, length), "contiguous data mismatch.\n");
memset(lock, 0xcc, length);
hr = IMFMediaBuffer_Unlock(buffer);
ok(hr == S_OK, "got hr %#lx.\n", hr);
......@@ -9600,7 +9600,7 @@ static void test_2dbuffer_copy_(IMFMediaBuffer *buffer, BOOL bottom_up, DWORD wi
memset(data, 0xcc, sizeof(data));
data[0] = ((BYTE *)test_data)[0];
check_reset_data(buffer2d, data, bottom_up, width, height, FALSE);
check_reset_data(buffer2d, data, bottom_up, width, height);
hr = IMF2DBuffer2_ContiguousCopyFrom(buffer2d, (BYTE *)test_data, sizeof(test_data));
ok(hr == S_OK, "got hr %#lx.\n", hr);
......@@ -9608,7 +9608,7 @@ static void test_2dbuffer_copy_(IMFMediaBuffer *buffer, BOOL bottom_up, DWORD wi
ok(hr == S_OK, "got hr %#lx.\n", hr);
ok(!memcmp(data, test_data, sizeof(data)), "data mismatch.\n");
check_reset_data(buffer2d, (const BYTE *)test_data, bottom_up, width, height, TRUE);
check_reset_data(buffer2d, (const BYTE *)test_data, bottom_up, width, height);
hr = IMFMediaBuffer_SetCurrentLength(src_buffer, sizeof(test_data) + 1);
ok(hr == S_OK, "got hr %#lx.\n", hr);
......@@ -9620,7 +9620,7 @@ static void test_2dbuffer_copy_(IMFMediaBuffer *buffer, BOOL bottom_up, DWORD wi
hr = IMFSample_CopyToBuffer(sample, buffer);
ok(hr == S_OK, "got hr %#lx.\n", hr);
check_reset_data(buffer2d, (const BYTE *)test_data, bottom_up, width, height, FALSE);
check_reset_data(buffer2d, (const BYTE *)test_data, bottom_up, width, height);
IMF2DBuffer2_Release(buffer2d);
ref = IMFSample_Release(sample);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment