mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
d3d11videosink: Fix for ignored initial render rectangle
Application can set target render rect before internal HWND configuration Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2518 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4480>
This commit is contained in:
parent
277a9f0cef
commit
4710f45e65
1 changed files with 23 additions and 6 deletions
|
@ -330,9 +330,10 @@ gst_d3d11_window_win32_set_render_rectangle (GstD3D11Window * window,
|
|||
{
|
||||
GstD3D11WindowWin32 *self = GST_D3D11_WINDOW_WIN32 (window);
|
||||
|
||||
self->render_rect = *rect;
|
||||
|
||||
if (self->external_hwnd && self->internal_hwnd) {
|
||||
g_atomic_int_add (&self->pending_move_window, 1);
|
||||
self->render_rect = *rect;
|
||||
|
||||
if (self->internal_hwnd_thread == g_thread_self ()) {
|
||||
/* We are on message pumping thread already, handle this synchroniously */
|
||||
|
@ -944,12 +945,21 @@ sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
/* take changes into account: SWP_FRAMECHANGED */
|
||||
GetClientRect (self->external_hwnd, &rect);
|
||||
|
||||
if (self->render_rect.x != 0 || self->render_rect.y != 0 ||
|
||||
self->render_rect.w != 0 || self->render_rect.h != 0) {
|
||||
rect.left = self->render_rect.x;
|
||||
rect.top = self->render_rect.y;
|
||||
rect.right = self->render_rect.x + self->render_rect.w;
|
||||
rect.bottom = self->render_rect.y + self->render_rect.h;
|
||||
}
|
||||
|
||||
SetWindowPos (self->internal_hwnd, HWND_TOP, rect.left, rect.top,
|
||||
rect.right, rect.bottom,
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
|
||||
SWP_FRAMECHANGED | SWP_NOACTIVATE);
|
||||
MoveWindow (self->internal_hwnd, rect.left, rect.top, rect.right,
|
||||
rect.bottom, FALSE);
|
||||
MoveWindow (self->internal_hwnd, rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top, FALSE);
|
||||
|
||||
self->overlay_state = GST_D3D11_WINDOW_WIN32_OVERLAY_STATE_OPENED;
|
||||
WakeAllConditionVariable (&self->cond);
|
||||
|
@ -960,8 +970,15 @@ sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
return 0;
|
||||
}
|
||||
case WM_SIZE:
|
||||
MoveWindow (self->internal_hwnd, 0, 0, LOWORD (lParam), HIWORD (lParam),
|
||||
FALSE);
|
||||
if (self->render_rect.x != 0 || self->render_rect.y != 0 ||
|
||||
self->render_rect.w != 0 || self->render_rect.h != 0) {
|
||||
MoveWindow (self->internal_hwnd,
|
||||
self->render_rect.x, self->render_rect.y,
|
||||
self->render_rect.w, self->render_rect.h, FALSE);
|
||||
} else {
|
||||
MoveWindow (self->internal_hwnd, 0, 0, LOWORD (lParam), HIWORD (lParam),
|
||||
FALSE);
|
||||
}
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
case WM_DESTROY:{
|
||||
|
|
Loading…
Reference in a new issue