quartz/vmr9: Resize the window in vmr_connect().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-05-05 19:03:45 -05:00 committed by Alexandre Julliard
parent 0f6d8846eb
commit d70d1cda38
3 changed files with 39 additions and 40 deletions

View File

@ -1825,21 +1825,21 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our
ok(top == 0, "Got top %d.\n", top);
hr = IVideoWindow_get_Width(window, &width);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
ok(width == expect_width, "Got width %d.\n", width);
hr = IVideoWindow_get_Height(window, &height);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(height == expect_height, "Got height %d.\n", height);
ok(height == expect_height, "Got height %d.\n", height);
hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(left == 0, "Got left %d.\n", left);
ok(top == 0, "Got top %d.\n", top);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
todo_wine ok(height == expect_height, "Got height %d.\n", height);
ok(width == expect_width, "Got width %d.\n", width);
ok(height == expect_height, "Got height %d.\n", height);
GetWindowRect(hwnd, &rect);
ok(rect.left == 0, "Got window left %d.\n", rect.left);
ok(rect.top == 0, "Got window top %d.\n", rect.top);
todo_wine ok(rect.right == expect_width, "Got window right %d.\n", rect.right);
todo_wine ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
ok(rect.right == expect_width, "Got window right %d.\n", rect.right);
ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
hr = IVideoWindow_put_Left(window, 10);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@ -1852,21 +1852,21 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our
ok(top == 0, "Got top %d.\n", top);
hr = IVideoWindow_get_Width(window, &width);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
ok(width == expect_width, "Got width %d.\n", width);
hr = IVideoWindow_get_Height(window, &height);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(height == expect_height, "Got height %d.\n", height);
ok(height == expect_height, "Got height %d.\n", height);
hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(left == 10, "Got left %d.\n", left);
ok(top == 0, "Got top %d.\n", top);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
todo_wine ok(height == expect_height, "Got height %d.\n", height);
ok(width == expect_width, "Got width %d.\n", width);
ok(height == expect_height, "Got height %d.\n", height);
GetWindowRect(hwnd, &rect);
ok(rect.left == 10, "Got window left %d.\n", rect.left);
ok(rect.top == 0, "Got window top %d.\n", rect.top);
todo_wine ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
todo_wine ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
hr = IVideoWindow_put_Height(window, 200);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@ -1879,7 +1879,7 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our
ok(top == 0, "Got top %d.\n", top);
hr = IVideoWindow_get_Width(window, &width);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
ok(width == expect_width, "Got width %d.\n", width);
hr = IVideoWindow_get_Height(window, &height);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(height == 200, "Got height %d.\n", height);
@ -1887,12 +1887,12 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(left == 10, "Got left %d.\n", left);
ok(top == 0, "Got top %d.\n", top);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
ok(width == expect_width, "Got width %d.\n", width);
ok(height == 200, "Got height %d.\n", height);
GetWindowRect(hwnd, &rect);
ok(rect.left == 10, "Got window left %d.\n", rect.left);
ok(rect.top == 0, "Got window top %d.\n", rect.top);
todo_wine ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
ok(rect.bottom == 200, "Got window bottom %d.\n", rect.bottom);
hr = IVideoWindow_SetWindowPosition(window, 100, 200, 300, 400);

View File

@ -2067,21 +2067,21 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our
ok(top == 0, "Got top %d.\n", top);
hr = IVideoWindow_get_Width(window, &width);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
ok(width == expect_width, "Got width %d.\n", width);
hr = IVideoWindow_get_Height(window, &height);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(height == expect_height, "Got height %d.\n", height);
ok(height == expect_height, "Got height %d.\n", height);
hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(left == 0, "Got left %d.\n", left);
ok(top == 0, "Got top %d.\n", top);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
todo_wine ok(height == expect_height, "Got height %d.\n", height);
ok(width == expect_width, "Got width %d.\n", width);
ok(height == expect_height, "Got height %d.\n", height);
GetWindowRect(hwnd, &rect);
ok(rect.left == 0, "Got window left %d.\n", rect.left);
ok(rect.top == 0, "Got window top %d.\n", rect.top);
todo_wine ok(rect.right == expect_width, "Got window right %d.\n", rect.right);
todo_wine ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
ok(rect.right == expect_width, "Got window right %d.\n", rect.right);
ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
hr = IVideoWindow_put_Left(window, 10);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@ -2094,21 +2094,21 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our
ok(top == 0, "Got top %d.\n", top);
hr = IVideoWindow_get_Width(window, &width);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
ok(width == expect_width, "Got width %d.\n", width);
hr = IVideoWindow_get_Height(window, &height);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(height == expect_height, "Got height %d.\n", height);
ok(height == expect_height, "Got height %d.\n", height);
hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(left == 10, "Got left %d.\n", left);
ok(top == 0, "Got top %d.\n", top);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
todo_wine ok(height == expect_height, "Got height %d.\n", height);
ok(width == expect_width, "Got width %d.\n", width);
ok(height == expect_height, "Got height %d.\n", height);
GetWindowRect(hwnd, &rect);
ok(rect.left == 10, "Got window left %d.\n", rect.left);
ok(rect.top == 0, "Got window top %d.\n", rect.top);
todo_wine ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
todo_wine ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
hr = IVideoWindow_put_Height(window, 200);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@ -2121,7 +2121,7 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our
ok(top == 0, "Got top %d.\n", top);
hr = IVideoWindow_get_Width(window, &width);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
ok(width == expect_width, "Got width %d.\n", width);
hr = IVideoWindow_get_Height(window, &height);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(height == 200, "Got height %d.\n", height);
@ -2129,12 +2129,12 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(left == 10, "Got left %d.\n", left);
ok(top == 0, "Got top %d.\n", top);
todo_wine ok(width == expect_width, "Got width %d.\n", width);
ok(width == expect_width, "Got width %d.\n", width);
ok(height == 200, "Got height %d.\n", height);
GetWindowRect(hwnd, &rect);
ok(rect.left == 10, "Got window left %d.\n", rect.left);
ok(rect.top == 0, "Got window top %d.\n", rect.top);
todo_wine ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
ok(rect.bottom == 200, "Got window bottom %d.\n", rect.bottom);
hr = IVideoWindow_SetWindowPosition(window, 100, 200, 300, 400);

View File

@ -381,9 +381,7 @@ static HRESULT initialize_device(struct quartz_vmr *filter, VMR9AllocationInfo *
}
}
SetRect(&filter->source_rect, 0, 0, filter->bmiheader.biWidth, filter->bmiheader.biHeight);
filter->num_surfaces = buffer_count;
return hr;
}
@ -483,14 +481,7 @@ static void vmr_start_stream(struct strmbase_renderer *iface)
TRACE("(%p)\n", This);
IVMRImagePresenter9_StartPresenting(This->presenter, This->cookie);
SetWindowPos(This->baseControlWindow.hwnd, NULL,
This->source_rect.left,
This->source_rect.top,
This->source_rect.right - This->source_rect.left,
This->source_rect.bottom - This->source_rect.top,
SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE);
ShowWindow(This->baseControlWindow.hwnd, SW_SHOW);
GetClientRect(This->baseControlWindow.hwnd, &This->target_rect);
SetEvent(This->run_event);
}
@ -518,12 +509,20 @@ static HRESULT vmr_connect(struct strmbase_renderer *iface, const AM_MEDIA_TYPE
{
struct quartz_vmr *filter = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
const BITMAPINFOHEADER *bitmap_header = get_bitmap_header(mt);
HWND window = filter->baseControlWindow.hwnd;
HRESULT hr;
RECT rect;
filter->bmiheader = *bitmap_header;
filter->VideoWidth = bitmap_header->biWidth;
filter->VideoHeight = bitmap_header->biHeight;
SetRect(&filter->source_rect, 0, 0, filter->VideoWidth, filter->VideoHeight);
SetRect(&rect, 0, 0, filter->VideoWidth, filter->VideoHeight);
filter->source_rect = filter->target_rect = rect;
AdjustWindowRectEx(&rect, GetWindowLongW(window, GWL_STYLE), FALSE,
GetWindowLongW(window, GWL_EXSTYLE));
SetWindowPos(window, NULL, 0, 0, rect.right - rect.left, rect.bottom - rect.top,
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
if (filter->mode
|| SUCCEEDED(hr = IVMRFilterConfig9_SetRenderingMode(&filter->IVMRFilterConfig9_iface, VMR9Mode_Windowed)))