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

Ziqing Hui zhui at codeweavers.com
Mon Jun 6 02:35:24 CDT 2022


Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
---
 dlls/d2d1/factory.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c
index b3b65b0cb92..1d7c8325077 100644
--- a/dlls/d2d1/factory.c
+++ b/dlls/d2d1/factory.c
@@ -856,10 +856,28 @@ 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);
+    HGLOBAL hglobal;
+    IStream *stream;
+    size_t size;
+    BYTE *data;
+    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);
+
+    size = sizeof(*property_xml) * (wcslen(property_xml) + 1);
+    hglobal = GlobalAlloc(0, size);
+    data = GlobalLock(hglobal);
+    memcpy(data, property_xml, size);
+    GlobalUnlock(hglobal);
+
+    if (FAILED(hr = CreateStreamOnHGlobal(hglobal, TRUE, &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