On Wed, 4 Aug 2021 at 04:26, Ziqing Hui zhui@codeweavers.com wrote:
On 8/3/21 11:53 PM, Henri Verbeet wrote:
static HRESULT STDMETHODCALLTYPE d2d_effect_SetInputCount(ID2D1Effect *iface, UINT32 count) {
- FIXME("iface %p, count %u stub!\n", iface, count);
- struct d2d_effect *effect = impl_from_ID2D1Effect(iface);
- unsigned int i;
- return E_NOTIMPL;
- TRACE("iface %p, count %u.\n", iface, count);
- if (count < effect->min_inputs || count > effect->max_inputs)
return E_INVALIDARG;
- if (count != effect->inputs_count)
- {
if (count < effect->inputs_count)
{
for (i = count; i < effect->inputs_count; ++i)
{
if (effect->inputs[i])
ID2D1Image_Release(effect->inputs[i]);
}
}
effect->inputs_count = count;
HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, effect->inputs, sizeof(*effect->inputs) * count);
- }
- return S_OK;
}
That doesn't generally work; the memory returned by HeapReAlloc() may not be the same as what was originally passed in. More broadly, it's not clear to me that we gain much from avoiding d2d_array_reserve() here.
I need to use HeapReAlloc(HEAP_ZERO_MEMORY) to initialize the newly allocated memory to zero.
Which way is better? HeapReAlloc(HEAP_ZERO_MEMORY) or d2d_array_reserve() + memset(0)?
I'd use memset().