Aric Stewart : quartz: Add offscreen presentation to VMR9.

Alexandre Julliard julliard at winehq.org
Tue May 22 14:21:28 CDT 2012


Module: wine
Branch: master
Commit: 0352a7fb88f603fcbacc904418a72b3dbf44011c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0352a7fb88f603fcbacc904418a72b3dbf44011c

Author: Aric Stewart <aric at codeweavers.com>
Date:   Mon May 21 07:53:52 2012 -0500

quartz: Add offscreen presentation to VMR9.

---

 dlls/quartz/vmr9.c |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c
index fc04269..efd14a1 100644
--- a/dlls/quartz/vmr9.c
+++ b/dlls/quartz/vmr9.c
@@ -1416,6 +1416,36 @@ static HRESULT VMR9_ImagePresenter_PresentTexture(VMR9DefaultAllocatorPresenterI
     return S_OK;
 }
 
+static HRESULT VMR9_ImagePresenter_PresentOffscreenSurface(VMR9DefaultAllocatorPresenterImpl *This, IDirect3DSurface9 *surface)
+{
+    HRESULT hr;
+    IDirect3DSurface9 *target = NULL;
+    RECT target_rect;
+
+    hr = IDirect3DDevice9_GetBackBuffer(This->d3d9_dev, 0, 0, D3DBACKBUFFER_TYPE_MONO, &target);
+    if (FAILED(hr))
+    {
+        ERR("IDirect3DDevice9_GetBackBuffer -- %08x\n", hr);
+        return hr;
+    }
+
+    target_rect = This->pVMR9->target_rect;
+    target_rect.right -= target_rect.left;
+    target_rect.bottom -= target_rect.top;
+    target_rect.left = target_rect.top = 0;
+
+    /* Flip */
+    target_rect.top = target_rect.bottom;
+    target_rect.bottom = 0;
+
+    hr = IDirect3DDevice9_StretchRect(This->d3d9_dev, surface, &This->pVMR9->source_rect, target, &target_rect, D3DTEXF_LINEAR);
+    if (FAILED(hr))
+        ERR("IDirect3DDevice9_StretchRect -- %08x\n", hr);
+    IDirect3DSurface9_Release(target);
+
+    return hr;
+}
+
 static HRESULT WINAPI VMR9_ImagePresenter_PresentImage(IVMRImagePresenter9 *iface, DWORD_PTR id, VMR9PresentationInfo *info)
 {
     VMR9DefaultAllocatorPresenterImpl *This = impl_from_IVMRImagePresenter9(iface);
@@ -1441,7 +1471,7 @@ static HRESULT WINAPI VMR9_ImagePresenter_PresentImage(IVMRImagePresenter9 *ifac
         if (This->d3d9_vertex)
             hr = VMR9_ImagePresenter_PresentTexture(This, info->lpSurf);
         else
-            hr = E_NOTIMPL;
+            hr = VMR9_ImagePresenter_PresentOffscreenSurface(This, info->lpSurf);
         render = SUCCEEDED(hr);
     }
     else




More information about the wine-cvs mailing list