[PATCH v3 4/5] d2d1: Implement RegisterEffectFromString().

Ziqing Hui zhui at codeweavers.com
Mon Jun 13 23:08:55 CDT 2022


Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
---

v3: Remove goto.

 dlls/d2d1/factory.c | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c
index 3f48557ca37..e5a82f7ffdb 100644
--- a/dlls/d2d1/factory.c
+++ b/dlls/d2d1/factory.c
@@ -938,10 +938,33 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_RegisterEffectFromString(ID2D1Facto
         REFCLSID effect_id, const WCHAR *property_xml, const D2D1_PROPERTY_BINDING *bindings,
         UINT32 binding_count, PD2D1_EFFECT_FACTORY effect_factory)
 {
-    FIXME("iface %p, effect_id %s, property_xml %s, bindings %p, binding_count %u, effect_factory %p stub!\n",
-            iface, debugstr_guid(effect_id), debugstr_w(property_xml), bindings, binding_count, effect_factory);
+    static const LARGE_INTEGER zero;
+    IStream *stream;
+    ULONG size;
+    HRESULT hr;
 
-    return S_OK;
+    TRACE("iface %p, effect_id %s, property_xml %s, bindings %p, binding_count %u, effect_factory %p.\n",
+          iface, debugstr_guid(effect_id), debugstr_w(property_xml), bindings, binding_count, effect_factory);
+
+    if (FAILED(hr = CreateStreamOnHGlobal(NULL, TRUE, &stream)))
+        return hr;
+
+    size = sizeof(*property_xml) * (wcslen(property_xml) + 1);
+    if (FAILED(hr = IStream_Write(stream, property_xml, size, NULL)))
+    {
+        IStream_Release(stream);
+        return hr;
+    }
+    if (FAILED(hr = IStream_Seek(stream, zero, SEEK_SET, NULL)))
+    {
+        IStream_Release(stream);
+        return hr;
+    }
+
+    hr = ID2D1Factory3_RegisterEffectFromStream(iface, effect_id, stream, bindings, binding_count, effect_factory);
+
+    IStream_Release(stream);
+    return hr;
 }
 
 static HRESULT STDMETHODCALLTYPE d2d_factory_UnregisterEffect(ID2D1Factory3 *iface, REFCLSID effect_id)
-- 
2.25.1




More information about the wine-devel mailing list