>From 54d566407c0ba0a11a8c5f95396c472331c499b5 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 11 Jul 2011 21:39:21 +1000
Subject: [PATCH] Add DISPID_PICT_RENDER support to OLEPictureImpl_Invoke
To: wine-patches <wine-patches@winehq.org>

---
 dlls/oleaut32/olepicture.c |   81 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 81 insertions(+), 0 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index 8081785..8e8e30d 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -2021,6 +2021,14 @@ static HRESULT WINAPI OLEPictureImpl_Invoke(
       return DISP_E_BADPARAMCOUNT;
     }
   }
+  else if (wFlags & DISPATCH_METHOD)
+  {
+    if (pDispParams->cArgs != 10)
+    {
+      ERR("param count for DISPATCH_METHOD was %d instead of 10\n", pDispParams->cArgs);
+      return DISP_E_BADPARAMCOUNT;
+    }
+  }
 
   switch (dispIdMember)
   {
@@ -2080,6 +2088,79 @@ static HRESULT WINAPI OLEPictureImpl_Invoke(
       return IPicture_get_Height(&This->IPicture_iface, &V_I4(pVarResult));
     }
     break;
+  case DISPID_PICT_RENDER:
+    if (wFlags & DISPATCH_METHOD)
+    {
+      VARIANTARG varHDC, varRect;
+      VARIANTARG varX, varY, varCX, varCY;
+      VARIANTARG varXSrc, varYSrc, varCXSrc, varCYSrc;
+      HRESULT hr;
+      RECT *pRect = NULL;
+
+      TRACE("DISPID_PICT_RENDER %d %d %d %d %d %d %d %d %d %d\n",
+            V_VT(&pDispParams->rgvarg[0]), V_VT(&pDispParams->rgvarg[1]),
+            V_VT(&pDispParams->rgvarg[2]), V_VT(&pDispParams->rgvarg[3]),
+            V_VT(&pDispParams->rgvarg[4]), V_VT(&pDispParams->rgvarg[5]),
+            V_VT(&pDispParams->rgvarg[6]), V_VT(&pDispParams->rgvarg[7]),
+            V_VT(&pDispParams->rgvarg[8]), V_VT(&pDispParams->rgvarg[9]));
+
+      VariantInit(&varHDC);
+      hr = VariantChangeTypeEx(&varHDC, &pDispParams->rgvarg[9], lcid, 0, VT_I4);
+      if (FAILED(hr))
+        return hr;
+
+      VariantInit(&varX);
+      hr = VariantChangeTypeEx(&varX, &pDispParams->rgvarg[8], lcid, 0, VT_I4);
+      if (FAILED(hr))
+        return hr;
+
+      VariantInit(&varY);
+      hr = VariantChangeTypeEx(&varY, &pDispParams->rgvarg[7], lcid, 0, VT_I4);
+      if (FAILED(hr))
+        return hr;
+
+      VariantInit(&varCX);
+      hr = VariantChangeTypeEx(&varCX, &pDispParams->rgvarg[6], lcid, 0, VT_I4);
+      if (FAILED(hr))
+        return hr;
+
+      VariantInit(&varCY);
+      hr = VariantChangeTypeEx(&varCY, &pDispParams->rgvarg[5], lcid, 0, VT_I4);
+      if (FAILED(hr))
+        return hr;
+
+      VariantInit(&varXSrc);
+      hr = VariantChangeTypeEx(&varXSrc, &pDispParams->rgvarg[4], lcid, 0, VT_I4);
+      if (FAILED(hr))
+        return hr;
+
+      VariantInit(&varYSrc);
+      hr = VariantChangeTypeEx(&varYSrc, &pDispParams->rgvarg[3], lcid, 0, VT_I4);
+      if (FAILED(hr))
+        return hr;
+
+      VariantInit(&varCXSrc);
+      hr = VariantChangeTypeEx(&varCXSrc, &pDispParams->rgvarg[2], lcid, 0, VT_I4);
+      if (FAILED(hr))
+        return hr;
+
+      VariantInit(&varCYSrc);
+      hr = VariantChangeTypeEx(&varCY, &pDispParams->rgvarg[1], lcid, 0, VT_I4);
+      if (FAILED(hr))
+        return hr;
+
+      VariantInit(&varRect);
+      hr = VariantChangeTypeEx(&varRect, &pDispParams->rgvarg[0], lcid, 0, VT_UI4 | VT_BYREF);
+      if (hr == S_OK)
+        pRect = V_INT_PTR(&varRect);
+
+      return IPicture_Render(&This->IPicture_iface, (HDC)V_I4(&varHDC),
+                             V_I4(&varX), V_I4(&varY), V_I4(&varCX), V_I4(&varCY),
+                             V_I4(&varXSrc), V_I4(&varYSrc),
+                             V_I4(&varCXSrc), V_I4(&varCYSrc),
+                             pRect);
+    }
+    break;
   }
 
   ERR("invalid dispid 0x%x or wFlags 0x%x\n", dispIdMember, wFlags);
-- 
1.7.5.4

