Zebediah Figura : quartz/videorenderer: Get the window DC in VideoRenderer_SendSampleData().

Alexandre Julliard julliard at winehq.org
Thu Oct 17 16:01:25 CDT 2019


Module: wine
Branch: master
Commit: 9cef48941e4965171e9bc49037199f2b4d2a53c5
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9cef48941e4965171e9bc49037199f2b4d2a53c5

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Oct 16 19:36:50 2019 -0500

quartz/videorenderer: Get the window DC in VideoRenderer_SendSampleData().

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 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 11a1183355..87365d9212 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;
 }




More information about the wine-cvs mailing list