Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/videorenderer.c | 18 ++++-------------- dlls/quartz/vmr9.c | 12 ------------ dlls/strmbase/window.c | 22 ++++++---------------- include/wine/strmbase.h | 6 ------ 4 files changed, 10 insertions(+), 48 deletions(-)
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 87491d8851c..a16a422e2d5 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -53,6 +53,8 @@ typedef struct VideoRendererImpl LONG VideoWidth; LONG VideoHeight; LONG FullScreenMode; + + DWORD saved_style; } VideoRendererImpl;
static inline VideoRendererImpl *impl_from_BaseWindow(BaseWindow *iface) @@ -392,17 +394,6 @@ static void video_renderer_start_stream(BaseRenderer *iface) } }
-static LPWSTR WINAPI VideoRenderer_GetClassWindowStyles(BaseWindow *This, DWORD *pClassStyles, DWORD *pWindowStyles, DWORD *pWindowStylesEx) -{ - static const WCHAR classnameW[] = { 'W','i','n','e',' ','A','c','t','i','v','e','M','o','v','i','e',' ','C','l','a','s','s',0 }; - - *pClassStyles = 0; - *pWindowStyles = WS_SIZEBOX; - *pWindowStylesEx = 0; - - return (LPWSTR)classnameW; -} - static RECT WINAPI VideoRenderer_GetDefaultRect(BaseWindow *iface) { VideoRendererImpl *This = impl_from_BaseWindow(iface); @@ -441,7 +432,6 @@ static const BaseRendererFuncTable BaseFuncTable = };
static const BaseWindowFuncTable renderer_BaseWindowFuncTable = { - VideoRenderer_GetClassWindowStyles, VideoRenderer_GetDefaultRect, VideoRenderer_OnSize }; @@ -674,7 +664,7 @@ static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface, FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, FullScreenMode);
if (FullScreenMode) { - This->baseControlWindow.baseWindow.WindowStyles = GetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE); + This->saved_style = GetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE); ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_HIDE); SetParent(This->baseControlWindow.baseWindow.hWnd, 0); SetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE, WS_POPUP); @@ -684,7 +674,7 @@ static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface, } else { ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_HIDE); SetParent(This->baseControlWindow.baseWindow.hWnd, This->baseControlWindow.hwndOwner); - SetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE, This->baseControlWindow.baseWindow.WindowStyles); + SetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE, This->saved_style); GetClientRect(This->baseControlWindow.baseWindow.hWnd, &This->DestRect); SetWindowPos(This->baseControlWindow.baseWindow.hWnd,0,This->DestRect.left,This->DestRect.top,This->DestRect.right,This->DestRect.bottom,SWP_NOZORDER|SWP_SHOWWINDOW); This->WindowPos = This->DestRect; diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index d3fdfb13a39..536703fbff1 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -568,17 +568,6 @@ static const BaseRendererFuncTable BaseFuncTable = .renderer_pin_query_interface = vmr_pin_query_interface, };
-static LPWSTR WINAPI VMR9_GetClassWindowStyles(BaseWindow *This, DWORD *pClassStyles, DWORD *pWindowStyles, DWORD *pWindowStylesEx) -{ - static WCHAR classnameW[] = { 'I','V','M','R','9',' ','C','l','a','s','s', 0 }; - - *pClassStyles = 0; - *pWindowStyles = WS_SIZEBOX; - *pWindowStylesEx = 0; - - return classnameW; -} - static RECT WINAPI VMR9_GetDefaultRect(BaseWindow *This) { struct quartz_vmr* pVMR9 = impl_from_BaseWindow(This); @@ -604,7 +593,6 @@ static BOOL WINAPI VMR9_OnSize(BaseWindow *This, LONG Width, LONG Height) }
static const BaseWindowFuncTable renderer_BaseWindowFuncTable = { - VMR9_GetClassWindowStyles, VMR9_GetDefaultRect, VMR9_OnSize, }; diff --git a/dlls/strmbase/window.c b/dlls/strmbase/window.c index fbf0edc78c5..142336bc193 100644 --- a/dlls/strmbase/window.c +++ b/dlls/strmbase/window.c @@ -110,33 +110,24 @@ HRESULT WINAPI BaseWindow_Destroy(BaseWindow *This)
HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This) { - WNDCLASSW winclass; + static const WCHAR class_nameW[] = {'w','i','n','e','_','s','t','r','m','b','a','s','e','_','w','i','n','d','o','w',0}; static const WCHAR windownameW[] = { 'A','c','t','i','v','e','M','o','v','i','e',' ','W','i','n','d','o','w',0 }; + WNDCLASSW winclass = {0};
- This->pClassName = This->pFuncsTable->pfnGetClassWindowStyles(This, &This->ClassStyles, &This->WindowStyles, &This->WindowStylesEx); - - winclass.style = This->ClassStyles; winclass.lpfnWndProc = WndProcW; - winclass.cbClsExtra = 0; winclass.cbWndExtra = sizeof(BaseWindow*); winclass.hInstance = This->hInstance; - winclass.hIcon = NULL; - winclass.hCursor = NULL; winclass.hbrBackground = GetStockObject(BLACK_BRUSH); - winclass.lpszMenuName = NULL; - winclass.lpszClassName = This->pClassName; + winclass.lpszClassName = class_nameW; if (!RegisterClassW(&winclass) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) { ERR("Unable to register window class: %u\n", GetLastError()); return E_FAIL; }
- This->hWnd = CreateWindowExW(This->WindowStylesEx, - This->pClassName, windownameW, - This->WindowStyles, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, NULL, NULL, This->hInstance, - NULL); + This->hWnd = CreateWindowExW(0, class_nameW, windownameW, WS_SIZEBOX, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + NULL, NULL, This->hInstance, NULL);
if (!This->hWnd) { @@ -305,7 +296,6 @@ HRESULT WINAPI BaseControlWindowImpl_put_WindowStyle(IVideoWindow *iface, LONG W SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, WindowStyle); SetWindowPos(This->baseWindow.hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); - This->baseWindow.WindowStyles = WindowStyle;
return S_OK; } diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 34a558ab8e8..11397170edc 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -360,23 +360,17 @@ typedef struct tagBaseWindow LONG Width; LONG Height; HINSTANCE hInstance; - LPWSTR pClassName; - DWORD ClassStyles; - DWORD WindowStyles; - DWORD WindowStylesEx; HDC hDC;
const struct BaseWindowFuncTable* pFuncsTable; } BaseWindow;
-typedef LPWSTR (WINAPI *BaseWindow_GetClassWindowStyles)(BaseWindow *This, DWORD *pClassStyles, DWORD *pWindowStyles, DWORD *pWindowStylesEx); typedef RECT (WINAPI *BaseWindow_GetDefaultRect)(BaseWindow *This); typedef BOOL (WINAPI *BaseWindow_OnSize)(BaseWindow *This, LONG Height, LONG Width);
typedef struct BaseWindowFuncTable { /* Required */ - BaseWindow_GetClassWindowStyles pfnGetClassWindowStyles; BaseWindow_GetDefaultRect pfnGetDefaultRect; /* Optional, WinProc Related */ BaseWindow_OnSize pfnOnSize;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/videorenderer.c | 3 ++- dlls/quartz/vmr9.c | 3 ++- dlls/strmbase/window.c | 12 +++--------- include/wine/strmbase.h | 1 - 4 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index a16a422e2d5..11a11833552 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -415,7 +415,8 @@ static BOOL WINAPI VideoRenderer_OnSize(BaseWindow *iface, LONG Width, LONG Heig This->DestRect.top, This->DestRect.right - This->DestRect.left, This->DestRect.bottom - This->DestRect.top); - return BaseWindowImpl_OnSize(iface, Width, Height); + + return TRUE; }
static const BaseRendererFuncTable BaseFuncTable = diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 536703fbff1..59a5152cf5b 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -589,7 +589,8 @@ static BOOL WINAPI VMR9_OnSize(BaseWindow *This, LONG Width, LONG Height) pVMR9->target_rect.top, pVMR9->target_rect.right - pVMR9->target_rect.left, pVMR9->target_rect.bottom - pVMR9->target_rect.top); - return BaseWindowImpl_OnSize(This, Width, Height); + + return TRUE; }
static const BaseWindowFuncTable renderer_BaseWindowFuncTable = { diff --git a/dlls/strmbase/window.c b/dlls/strmbase/window.c index 142336bc193..82bb814827a 100644 --- a/dlls/strmbase/window.c +++ b/dlls/strmbase/window.c @@ -74,20 +74,14 @@ static LRESULT CALLBACK WndProcW(HWND hwnd, UINT message, WPARAM wparam, LPARAM case WM_SIZE: if (This->pFuncsTable->pfnOnSize) return This->pFuncsTable->pfnOnSize(This, LOWORD(lparam), HIWORD(lparam)); - else - return BaseWindowImpl_OnSize(This, LOWORD(lparam), HIWORD(lparam)); + + This->Width = LOWORD(lparam); + This->Height = HIWORD(lparam); }
return DefWindowProcW(hwnd, message, wparam, lparam); }
-BOOL WINAPI BaseWindowImpl_OnSize(BaseWindow *This, LONG Width, LONG Height) -{ - This->Width = Width; - This->Height = Height; - return TRUE; -} - HRESULT WINAPI BaseWindow_Init(BaseWindow *pBaseWindow, const BaseWindowFuncTable* pFuncsTable) { if (!pFuncsTable) diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 11397170edc..13544f414b6 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -381,7 +381,6 @@ HRESULT WINAPI BaseWindow_Destroy(BaseWindow *pBaseWindow);
HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This); HRESULT WINAPI BaseWindowImpl_DoneWithWindow(BaseWindow *This); -BOOL WINAPI BaseWindowImpl_OnSize(BaseWindow *This, LONG Height, LONG Width);
enum strmbase_type_id {
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/strmbase/window.c | 3 +-- include/wine/strmbase.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/strmbase/window.c b/dlls/strmbase/window.c index 82bb814827a..c99a529fa27 100644 --- a/dlls/strmbase/window.c +++ b/dlls/strmbase/window.c @@ -110,7 +110,6 @@ HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This)
winclass.lpfnWndProc = WndProcW; winclass.cbWndExtra = sizeof(BaseWindow*); - winclass.hInstance = This->hInstance; winclass.hbrBackground = GetStockObject(BLACK_BRUSH); winclass.lpszClassName = class_nameW; if (!RegisterClassW(&winclass) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) @@ -121,7 +120,7 @@ HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This)
This->hWnd = CreateWindowExW(0, class_nameW, windownameW, WS_SIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, This->hInstance, NULL); + NULL, NULL, NULL, NULL);
if (!This->hWnd) { diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 13544f414b6..cc06e704476 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -359,7 +359,6 @@ typedef struct tagBaseWindow HWND hWnd; LONG Width; LONG Height; - HINSTANCE hInstance; HDC hDC;
const struct BaseWindowFuncTable* pFuncsTable;
Partly because we cannot depend on the filter being destroyed on the same thread as it was allocated from.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/videorenderer.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 11a11833552..87365d92124 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -155,6 +155,7 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, AM_MEDIA_TYPE amt; HRESULT hr = S_OK; BITMAPINFOHEADER *bmiHeader; + HDC dc;
TRACE("(%p)->(%p, %d)\n", This, data, size);
@@ -178,18 +179,15 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, return VFW_E_RUNTIME_ERROR; }
- if (!This->baseControlWindow.baseWindow.hDC) { - ERR("Cannot get DC from window!\n"); - return E_FAIL; - } - TRACE("Src Rect: %s\n", wine_dbgstr_rect(&This->SourceRect)); TRACE("Dst Rect: %s\n", wine_dbgstr_rect(&This->DestRect));
- StretchDIBits(This->baseControlWindow.baseWindow.hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left, + dc = GetDC(This->baseControlWindow.baseWindow.hWnd); + StretchDIBits(dc, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left, This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top, This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top, data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY); + ReleaseDC(This->baseControlWindow.baseWindow.hWnd, dc);
return S_OK; }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/strmbase/window.c | 6 ------ include/wine/strmbase.h | 1 - 2 files changed, 7 deletions(-)
diff --git a/dlls/strmbase/window.c b/dlls/strmbase/window.c index c99a529fa27..23f37de52b9 100644 --- a/dlls/strmbase/window.c +++ b/dlls/strmbase/window.c @@ -130,8 +130,6 @@ HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This)
SetWindowLongPtrW(This->hWnd, 0, (LONG_PTR)This);
- This->hDC = GetDC(This->hWnd); - return S_OK; }
@@ -140,10 +138,6 @@ HRESULT WINAPI BaseWindowImpl_DoneWithWindow(BaseWindow *This) if (!This->hWnd) return S_OK;
- if (This->hDC) - ReleaseDC(This->hWnd, This->hDC); - This->hDC = NULL; - SendMessageW(This->hWnd, WM_CLOSE, 0, 0); This->hWnd = NULL;
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index cc06e704476..5be7caa371e 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -359,7 +359,6 @@ typedef struct tagBaseWindow HWND hWnd; LONG Width; LONG Height; - HDC hDC;
const struct BaseWindowFuncTable* pFuncsTable; } BaseWindow;