[PATCH 3/3] d2d1: Add stubs for ID2D1TransformGraph.

Ziqing Hui zhui at codeweavers.com
Mon Jun 20 22:17:08 CDT 2022


Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
---
 dlls/d2d1/d2d1_private.h |   1 +
 dlls/d2d1/effect.c       | 161 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 156 insertions(+), 6 deletions(-)

diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index ffe1cd9e1dc..a42bf367916 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -657,6 +657,7 @@ struct d2d_effect
     UINT32 min_inputs;
     UINT32 max_inputs;
 
+    ID2D1TransformGraph *transform_graph;
     ID2D1EffectImpl *impl;
     struct d2d_effect_context *effect_context;
     ID2D1Image **inputs;
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c
index c1ef67c89aa..23f117c85bf 100644
--- a/dlls/d2d1/effect.c
+++ b/dlls/d2d1/effect.c
@@ -20,6 +20,12 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d2d);
 
+struct d2d_transform_graph
+{
+    ID2D1TransformGraph ID2D1TransformGraph_iface;
+    LONG refcount;
+};
+
 struct d2d_effect_impl
 {
     ID2D1EffectImpl ID2D1EffectImpl_iface;
@@ -35,6 +41,136 @@ struct d2d_builtin_effect_registration
     UINT32 max_inputs;
 };
 
+static inline struct d2d_transform_graph *impl_from_ID2D1TransformGraph(ID2D1TransformGraph *iface)
+{
+    return CONTAINING_RECORD(iface, struct d2d_transform_graph, ID2D1TransformGraph_iface);
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_transform_graph_QueryInterface(ID2D1TransformGraph *iface, REFIID iid, void **out)
+{
+    TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
+
+    if (IsEqualGUID(iid, &IID_ID2D1TransformGraph)
+            || IsEqualGUID(iid, &IID_IUnknown))
+    {
+        ID2D1TransformGraph_AddRef(iface);
+        *out = iface;
+        return S_OK;
+    }
+
+    *out = NULL;
+    return E_NOINTERFACE;
+}
+
+static ULONG STDMETHODCALLTYPE d2d_transform_graph_AddRef(ID2D1TransformGraph *iface)
+{
+    struct d2d_transform_graph *graph =impl_from_ID2D1TransformGraph(iface);
+    ULONG refcount = InterlockedIncrement(&graph->refcount);
+
+    TRACE("%p increasing refcount to %lu.\n", iface, refcount);
+
+    return refcount;
+}
+
+static ULONG STDMETHODCALLTYPE d2d_transform_graph_Release(ID2D1TransformGraph *iface)
+{
+    struct d2d_transform_graph *graph = impl_from_ID2D1TransformGraph(iface);
+    ULONG refcount = InterlockedDecrement(&graph->refcount);
+
+    TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
+
+    if (!refcount)
+        free(graph);
+
+    return refcount;
+}
+
+static UINT32 STDMETHODCALLTYPE d2d_transform_graph_GetInputCount(ID2D1TransformGraph *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+
+    return 0;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_transform_graph_SetSingleTransformNode(ID2D1TransformGraph *iface,
+        ID2D1TransformNode *node)
+{
+    FIXME("iface %p, node %p stub!\n", iface, node);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_transform_graph_AddNode(ID2D1TransformGraph *iface, ID2D1TransformNode *node)
+{
+    FIXME("iface %p, node %p stub!\n", iface, node);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_transform_graph_RemoveNode(ID2D1TransformGraph *iface, ID2D1TransformNode *node)
+{
+    FIXME("iface %p, node %p stub!\n", iface, node);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_transform_graph_SetOutputNode(ID2D1TransformGraph *iface, ID2D1TransformNode *node)
+{
+    FIXME("iface %p, node %p stub!\n", iface, node);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_transform_graph_ConnectNode(ID2D1TransformGraph *iface,
+        ID2D1TransformNode *from_node, ID2D1TransformNode *to_node, UINT32 index)
+{
+    FIXME("iface %p, from_node %p, to_node %p, index %u stub!\n", iface, from_node, to_node, index);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_transform_graph_ConnectToEffectInput(ID2D1TransformGraph *iface,
+        UINT32 input_index, ID2D1TransformNode *node, UINT32 node_index)
+{
+    FIXME("iface %p, input_index %u, node %p, node_index %u stub!\n", iface, input_index, node, node_index);
+
+    return E_NOTIMPL;
+}
+
+static void STDMETHODCALLTYPE d2d_transform_graph_Clear(ID2D1TransformGraph *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_transform_graph_SetPassthroughGraph(ID2D1TransformGraph *iface, UINT32 index)
+{
+    FIXME("iface %p, index %u stub!\n", iface, index);
+
+    return E_NOTIMPL;
+}
+
+static const ID2D1TransformGraphVtbl d2d_transform_graph_vtbl =
+{
+    d2d_transform_graph_QueryInterface,
+    d2d_transform_graph_AddRef,
+    d2d_transform_graph_Release,
+    d2d_transform_graph_GetInputCount,
+    d2d_transform_graph_SetSingleTransformNode,
+    d2d_transform_graph_AddNode,
+    d2d_transform_graph_RemoveNode,
+    d2d_transform_graph_SetOutputNode,
+    d2d_transform_graph_ConnectNode,
+    d2d_transform_graph_ConnectToEffectInput,
+    d2d_transform_graph_Clear,
+    d2d_transform_graph_SetPassthroughGraph,
+};
+
+static void d2d_transform_graph_init(struct d2d_transform_graph *graph)
+{
+    graph->ID2D1TransformGraph_iface.lpVtbl = &d2d_transform_graph_vtbl;
+    graph->refcount = 1;
+}
+
 static inline struct d2d_effect_impl *impl_from_ID2D1EffectImpl(ID2D1EffectImpl *iface)
 {
     return CONTAINING_RECORD(iface, struct d2d_effect_impl, ID2D1EffectImpl_iface);
@@ -524,6 +660,7 @@ static void d2d_effect_cleanup(struct d2d_effect *effect)
     free(effect->inputs);
     ID2D1EffectContext_Release(&effect->effect_context->ID2D1EffectContext_iface);
     ID2D1EffectImpl_Release(effect->impl);
+    ID2D1TransformGraph_Release(effect->transform_graph);
 }
 
 static HRESULT STDMETHODCALLTYPE d2d_effect_QueryInterface(ID2D1Effect *iface, REFIID iid, void **out)
@@ -852,6 +989,7 @@ static const ID2D1ImageVtbl d2d_effect_image_vtbl =
 
 HRESULT d2d_effect_init(struct d2d_effect *effect, struct d2d_effect_context *effect_context, const CLSID *effect_id)
 {
+    struct d2d_transform_graph *transform_graph = NULL;
     struct d2d_effect_registration *reg;
     struct d2d_factory *factory;
     HRESULT hr;
@@ -865,13 +1003,18 @@ HRESULT d2d_effect_init(struct d2d_effect *effect, struct d2d_effect_context *ef
     {
         if (IsEqualGUID(effect_id, &reg->id))
         {
+            if (!(transform_graph = calloc(1, sizeof(*transform_graph))))
+                return E_OUTOFMEMORY;
+            d2d_transform_graph_init(transform_graph);
+
             if (FAILED(hr = reg->factory((IUnknown **)&effect->impl)))
-                return hr;
-            if (FAILED(hr = ID2D1EffectImpl_Initialize(effect->impl, &effect_context->ID2D1EffectContext_iface, NULL)))
-            {
-                ID2D1EffectImpl_Release(effect->impl);
-                return hr;
-            }
+                goto err;
+            effect->transform_graph = &transform_graph->ID2D1TransformGraph_iface;
+
+            if (FAILED(hr = ID2D1EffectImpl_Initialize(effect->impl,
+                    &effect_context->ID2D1EffectContext_iface, effect->transform_graph)))
+                goto err;
+
             effect->id = *effect_id;
             effect->min_inputs = reg->min_inputs;
             effect->max_inputs = reg->max_inputs;
@@ -885,6 +1028,12 @@ HRESULT d2d_effect_init(struct d2d_effect *effect, struct d2d_effect_context *ef
 
     WARN("Unsupported effect clsid %s.\n", debugstr_guid(effect_id));
     return E_FAIL;
+
+err:
+    if (effect->impl)
+        ID2D1EffectImpl_Release(effect->impl);
+    free(transform_graph);
+    return hr;
 }
 
 HRESULT d2d_register_builtin_effects(struct d2d_factory *factory)
-- 
2.25.1




More information about the wine-devel mailing list