1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00

d2d1/effect: Implement ConnectNode().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2024-05-16 16:21:44 +02:00 committed by Alexandre Julliard
parent be646151b9
commit 4ad75a7ae8
3 changed files with 48 additions and 7 deletions

View File

@ -753,6 +753,9 @@ struct d2d_transform_node
struct list entry;
ID2D1TransformNode *object;
struct d2d_render_info *render_info;
struct d2d_transform_node **inputs;
unsigned int input_count;
struct d2d_transform_node *output;
};
struct d2d_transform_node_connection

View File

@ -620,6 +620,12 @@ static HRESULT d2d_transform_graph_add_node(struct d2d_transform_graph *graph,
if (!(node = calloc(1, sizeof(*node))))
return E_OUTOFMEMORY;
node->input_count = ID2D1TransformNode_GetInputCount(object);
if (!(node->inputs = calloc(node->input_count, sizeof(*node->inputs))))
{
free(node);
return E_OUTOFMEMORY;
}
node->object = object;
ID2D1TransformNode_AddRef(node->object);
@ -628,6 +634,24 @@ static HRESULT d2d_transform_graph_add_node(struct d2d_transform_graph *graph,
return S_OK;
}
static void d2d_transform_node_disconnect(struct d2d_transform_node *node)
{
struct d2d_transform_node *output = node->output;
unsigned int i;
if (!output)
return;
for (i = 0; i < output->input_count; ++i)
{
if (output->inputs[i] == node)
{
output->inputs[i] = NULL;
break;
}
}
}
static void d2d_transform_graph_delete_node(struct d2d_transform_graph *graph,
struct d2d_transform_node *node)
{
@ -648,6 +672,9 @@ static void d2d_transform_graph_delete_node(struct d2d_transform_graph *graph,
if (node->render_info)
ID2D1DrawInfo_Release(&node->render_info->ID2D1DrawInfo_iface);
d2d_transform_node_disconnect(node);
free(node->inputs);
free(node);
}
@ -797,9 +824,25 @@ static HRESULT STDMETHODCALLTYPE d2d_transform_graph_SetOutputNode(ID2D1Transfor
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);
struct d2d_transform_graph *graph = impl_from_ID2D1TransformGraph(iface);
struct d2d_transform_node *from, *to;
return E_NOTIMPL;
TRACE("iface %p, from_node %p, to_node %p, index %u.\n", iface, from_node, to_node, index);
if (!(from = d2d_transform_graph_get_node(graph, from_node)))
return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
if (!(to = d2d_transform_graph_get_node(graph, to_node)))
return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
if (index >= to->input_count)
return E_INVALIDARG;
d2d_transform_node_disconnect(from);
to->inputs[index] = from;
from->output = to;
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d2d_transform_graph_ConnectToEffectInput(ID2D1TransformGraph *iface,

View File

@ -12873,7 +12873,6 @@ static void test_transform_graph(BOOL d3d11)
ID2D1TransformGraph_Clear(graph);
hr = ID2D1TransformGraph_ConnectNode(graph,
(ID2D1TransformNode *)offset_transform, (ID2D1TransformNode *)blend_transform, 0);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
/* Connect added node to un-added node */
@ -12881,7 +12880,6 @@ static void test_transform_graph(BOOL d3d11)
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1TransformGraph_ConnectNode(graph,
(ID2D1TransformNode *)offset_transform, (ID2D1TransformNode *)blend_transform, 0);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
/* Connect un-added node to added node */
@ -12890,7 +12888,6 @@ static void test_transform_graph(BOOL d3d11)
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1TransformGraph_ConnectNode(graph,
(ID2D1TransformNode *)offset_transform, (ID2D1TransformNode *)blend_transform, 0);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
/* Connect nodes */
@ -12904,14 +12901,12 @@ static void test_transform_graph(BOOL d3d11)
{
hr = ID2D1TransformGraph_ConnectNode(graph,
(ID2D1TransformNode *)offset_transform, (ID2D1TransformNode *)blend_transform, i);
todo_wine
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
}
/* Connect node to out-of-bounds index */
hr = ID2D1TransformGraph_ConnectNode(graph,
(ID2D1TransformNode *)offset_transform, (ID2D1TransformNode *)blend_transform, count);
todo_wine
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
/* Passthrough graph. */