Commit fb6ad569 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz/videorenderer: Resize the window in video_renderer_connect().

parent e5729cf8
......@@ -246,8 +246,8 @@ static void test_basic_video(IFilterGraph2 *graph)
ok(hr == S_OK, "Cannot get destination position returned: %x\n", hr);
ok(left == 0, "expected 0, got %d\n", left);
ok(top == 0, "expected 0, got %d\n", top);
todo_wine ok(width == window_width, "expected %d, got %d\n", window_width, width);
todo_wine ok(height == video_height, "expected %d, got %d\n", video_height, height);
ok(width == window_width, "expected %d, got %d\n", window_width, width);
ok(height == video_height, "expected %d, got %d\n", video_height, height);
hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, 0, 0);
ok(hr==E_INVALIDARG, "IBasicVideo_SetDestinationPosition returned: %x\n", hr);
......
......@@ -1855,21 +1855,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);
......@@ -1882,21 +1882,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);
......@@ -1909,7 +1909,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);
......@@ -1917,12 +1917,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);
......
......@@ -44,11 +44,8 @@ struct video_renderer
IOverlay IOverlay_iface;
BOOL init;
RECT SourceRect;
RECT DestRect;
RECT WindowPos;
LONG VideoWidth;
LONG VideoHeight;
LONG FullScreenMode;
......@@ -89,53 +86,6 @@ static const BITMAPINFOHEADER *get_bitmap_header(const AM_MEDIA_TYPE *mt)
static void VideoRenderer_AutoShowWindow(struct video_renderer *This)
{
if (!This->init && (!This->WindowPos.right || !This->WindowPos.top))
{
DWORD style = GetWindowLongW(This->baseControlWindow.hwnd, GWL_STYLE);
DWORD style_ex = GetWindowLongW(This->baseControlWindow.hwnd, GWL_EXSTYLE);
if (!This->WindowPos.right)
{
if (This->DestRect.right)
{
This->WindowPos.left = This->DestRect.left;
This->WindowPos.right = This->DestRect.right;
}
else
{
This->WindowPos.left = This->SourceRect.left;
This->WindowPos.right = This->SourceRect.right;
}
}
if (!This->WindowPos.bottom)
{
if (This->DestRect.bottom)
{
This->WindowPos.top = This->DestRect.top;
This->WindowPos.bottom = This->DestRect.bottom;
}
else
{
This->WindowPos.top = This->SourceRect.top;
This->WindowPos.bottom = This->SourceRect.bottom;
}
}
AdjustWindowRectEx(&This->WindowPos, style, FALSE, style_ex);
TRACE("WindowPos: %s\n", wine_dbgstr_rect(&This->WindowPos));
SetWindowPos(This->baseControlWindow.hwnd, NULL,
This->WindowPos.left,
This->WindowPos.top,
This->WindowPos.right - This->WindowPos.left,
This->WindowPos.bottom - This->WindowPos.top,
SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE);
GetClientRect(This->baseControlWindow.hwnd, &This->DestRect);
}
else if (!This->init)
This->DestRect = This->WindowPos;
This->init = TRUE;
if (This->baseControlWindow.AutoShow)
ShowWindow(This->baseControlWindow.hwnd, SW_SHOW);
}
......@@ -280,10 +230,18 @@ static HRESULT video_renderer_connect(struct strmbase_renderer *iface, const AM_
{
struct video_renderer *filter = impl_from_strmbase_renderer(iface);
const BITMAPINFOHEADER *bitmap_header = get_bitmap_header(mt);
HWND window = filter->baseControlWindow.hwnd;
RECT rect;
filter->VideoWidth = bitmap_header->biWidth;
filter->VideoHeight = abs(bitmap_header->biHeight);
SetRect(&filter->SourceRect, 0, 0, filter->VideoWidth, filter->VideoHeight);
SetRect(&rect, 0, 0, filter->VideoWidth, filter->VideoHeight);
filter->SourceRect = filter->DestRect = 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);
return S_OK;
}
......@@ -511,7 +469,6 @@ static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface, LONG f
SetWindowPos(filter->baseControlWindow.hwnd, HWND_TOP, 0, 0,
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_SHOWWINDOW);
GetWindowRect(filter->baseControlWindow.hwnd, &filter->DestRect);
filter->WindowPos = filter->DestRect;
}
else
{
......@@ -521,7 +478,6 @@ static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface, LONG f
GetClientRect(filter->baseControlWindow.hwnd, &filter->DestRect);
SetWindowPos(filter->baseControlWindow.hwnd, 0, filter->DestRect.left, filter->DestRect.top,
filter->DestRect.right, filter->DestRect.bottom, SWP_NOZORDER | SWP_SHOWWINDOW);
filter->WindowPos = filter->DestRect;
}
filter->FullScreenMode = fullscreen;
......
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