Commit a2935a51 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d2d1/effect: Move effect instance creation to the device context.

Creating new effects from effect context does not reuse calling context. Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com>
parent 7eabfd47
......@@ -1947,18 +1947,35 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateEffect(ID2D1DeviceCont
{
struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
struct d2d_effect_context *effect_context;
struct d2d_effect *object;
HRESULT hr;
FIXME("iface %p, effect_id %s, effect %p stub!\n", iface, debugstr_guid(effect_id), effect);
TRACE("iface %p, effect_id %s, effect %p.\n", iface, debugstr_guid(effect_id), effect);
if (!(effect_context = calloc(1, sizeof(*effect_context))))
return E_OUTOFMEMORY;
d2d_effect_context_init(effect_context, context);
hr = ID2D1EffectContext_CreateEffect(&effect_context->ID2D1EffectContext_iface, effect_id, effect);
if (!(object = calloc(1, sizeof(*object))))
{
ID2D1EffectContext_Release(&effect_context->ID2D1EffectContext_iface);
return E_OUTOFMEMORY;
}
hr = d2d_effect_init(object, effect_context, effect_id);
ID2D1EffectContext_Release(&effect_context->ID2D1EffectContext_iface);
return hr;
if (FAILED(hr))
{
WARN("Failed to initialise effect, hr %#lx.\n", hr);
free(object);
return hr;
}
*effect = &object->ID2D1Effect_iface;
TRACE("Created effect %p.\n", *effect);
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_CreateGradientStopCollection(
......
......@@ -123,25 +123,11 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_context_CreateEffect(ID2D1EffectCont
REFCLSID clsid, ID2D1Effect **effect)
{
struct d2d_effect_context *effect_context = impl_from_ID2D1EffectContext(iface);
struct d2d_effect *object;
HRESULT hr;
TRACE("iface %p, clsid %s, effect %p.\n", iface, debugstr_guid(clsid), effect);
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d2d_effect_init(object, effect_context, clsid)))
{
WARN("Failed to initialise effect, hr %#lx.\n", hr);
free(object);
return hr;
}
TRACE("Created effect %p.\n", object);
*effect = &object->ID2D1Effect_iface;
return S_OK;
return ID2D1DeviceContext1_CreateEffect(&effect_context->device_context->ID2D1DeviceContext1_iface,
clsid, effect);
}
static HRESULT STDMETHODCALLTYPE d2d_effect_context_GetMaximumSupportedFeatureLevel(ID2D1EffectContext *iface,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment