[PATCH 5/9] d2d1: Add an effect context reference to effect.
Ziqing Hui
zhui at codeweavers.com
Wed Apr 27 23:26:17 CDT 2022
Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
---
See https://docs.microsoft.com/en-us/windows/win32/api/d2d1effectauthor/nn-d2d1effectauthor-id2d1effectcontext
"Each call to ID2D1EffectImpl::Initialize will be provided a different ID2D1EffectContext interface.
This interface tracks resource allocations for the effect. When the effect is released,
the corresponding allocations will also be released."
dlls/d2d1/d2d1_private.h | 4 +++-
dlls/d2d1/effect.c | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 8077f44477b..9b5a849c3f2 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -596,13 +596,15 @@ struct d2d_effect
const struct d2d_effect_info *info;
+ ID2D1EffectContext *effect_context;
ID2D1Factory *factory;
ID2D1Image **inputs;
size_t inputs_size;
size_t input_count;
};
-HRESULT d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory, const CLSID *effect_id) DECLSPEC_HIDDEN;
+HRESULT d2d_effect_init(struct d2d_effect *effect,
+ ID2D1EffectContext *effect_context, ID2D1Factory *factory, const CLSID *effect_id) DECLSPEC_HIDDEN;
static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
{
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c
index 175248e3a42..af826701beb 100644
--- a/dlls/d2d1/effect.c
+++ b/dlls/d2d1/effect.c
@@ -309,6 +309,7 @@ static void d2d_effect_cleanup(struct d2d_effect *effect)
}
heap_free(effect->inputs);
ID2D1Factory_Release(effect->factory);
+ ID2D1EffectContext_Release(effect->effect_context);
}
static HRESULT STDMETHODCALLTYPE d2d_effect_QueryInterface(ID2D1Effect *iface, REFIID iid, void **out)
@@ -635,7 +636,8 @@ static const ID2D1ImageVtbl d2d_effect_image_vtbl =
d2d_effect_image_GetFactory,
};
-HRESULT d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory, const CLSID *effect_id)
+HRESULT d2d_effect_init(struct d2d_effect *effect,
+ ID2D1EffectContext *effect_context, ID2D1Factory *factory, const CLSID *effect_id)
{
unsigned int i;
@@ -649,6 +651,7 @@ HRESULT d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory, const
{
effect->info = &builtin_effects[i];
d2d_effect_SetInputCount(&effect->ID2D1Effect_iface, effect->info->default_input_count);
+ ID2D1EffectContext_AddRef(effect->effect_context = effect_context);
ID2D1Factory_AddRef(effect->factory = factory);
return S_OK;
}
--
2.25.1
More information about the wine-devel
mailing list