d3d11window: Initialize surface rect with given external window handle

Unlike internal window, resize event might not happen with external window.
This commit is contained in:
Seungha Yang 2019-12-11 21:51:03 +09:00
parent a8ec409b84
commit a400126889

View file

@ -1104,8 +1104,19 @@ gst_d3d11_window_prepare (GstD3D11Window * window, guint width, guint height,
window->render_rect.w = width; window->render_rect.w = width;
window->render_rect.h = height; window->render_rect.h = height;
desc.BufferDesc.Width = window->width = window->surface_width = width; if (window->external_win_id) {
desc.BufferDesc.Height = window->height = window->surface_height = height; RECT client_rect = { 0, };
GetClientRect (window->external_win_id, &client_rect);
window->surface_width = client_rect.right - client_rect.left;
window->surface_height = client_rect.bottom - client_rect.top;
} else {
window->surface_width = width;
window->surface_height = height;
}
desc.BufferDesc.Width = window->width = window->surface_width;
desc.BufferDesc.Height = window->height = window->surface_height;
/* don't care refresh rate */ /* don't care refresh rate */
desc.BufferDesc.RefreshRate.Numerator = 0; desc.BufferDesc.RefreshRate.Numerator = 0;
desc.BufferDesc.RefreshRate.Denominator = 1; desc.BufferDesc.RefreshRate.Denominator = 1;