d2d1: Implement d2d_gradient_GetFactory().
This commit is contained in:
parent
4e50527c17
commit
91b9ce69b7
|
@ -68,6 +68,7 @@ static ULONG STDMETHODCALLTYPE d2d_gradient_Release(ID2D1GradientStopCollection
|
|||
if (!refcount)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, gradient->stops);
|
||||
ID2D1Factory_Release(gradient->factory);
|
||||
HeapFree(GetProcessHeap(), 0, gradient);
|
||||
}
|
||||
|
||||
|
@ -76,9 +77,11 @@ static ULONG STDMETHODCALLTYPE d2d_gradient_Release(ID2D1GradientStopCollection
|
|||
|
||||
static void STDMETHODCALLTYPE d2d_gradient_GetFactory(ID2D1GradientStopCollection *iface, ID2D1Factory **factory)
|
||||
{
|
||||
FIXME("iface %p, factory %p stub!\n", iface, factory);
|
||||
struct d2d_gradient *gradient = impl_from_ID2D1GradientStopCollection(iface);
|
||||
|
||||
*factory = NULL;
|
||||
TRACE("iface %p, factory %p.\n", iface, factory);
|
||||
|
||||
ID2D1Factory_AddRef(*factory = gradient->factory);
|
||||
}
|
||||
|
||||
static UINT32 STDMETHODCALLTYPE d2d_gradient_GetGradientStopCount(ID2D1GradientStopCollection *iface)
|
||||
|
@ -128,13 +131,14 @@ static const struct ID2D1GradientStopCollectionVtbl d2d_gradient_vtbl =
|
|||
d2d_gradient_GetExtendMode,
|
||||
};
|
||||
|
||||
HRESULT d2d_gradient_init(struct d2d_gradient *gradient, ID2D1RenderTarget *render_target,
|
||||
HRESULT d2d_gradient_init(struct d2d_gradient *gradient, ID2D1Factory *factory,
|
||||
const D2D1_GRADIENT_STOP *stops, UINT32 stop_count, D2D1_GAMMA gamma, D2D1_EXTEND_MODE extend_mode)
|
||||
{
|
||||
FIXME("Ignoring gradient properties.\n");
|
||||
|
||||
gradient->ID2D1GradientStopCollection_iface.lpVtbl = &d2d_gradient_vtbl;
|
||||
gradient->refcount = 1;
|
||||
ID2D1Factory_AddRef(gradient->factory = factory);
|
||||
|
||||
gradient->stop_count = stop_count;
|
||||
if (!(gradient->stops = HeapAlloc(GetProcessHeap(), 0, stop_count * sizeof(*stops))))
|
||||
|
|
|
@ -112,11 +112,12 @@ struct d2d_gradient
|
|||
ID2D1GradientStopCollection ID2D1GradientStopCollection_iface;
|
||||
LONG refcount;
|
||||
|
||||
ID2D1Factory *factory;
|
||||
D2D1_GRADIENT_STOP *stops;
|
||||
UINT32 stop_count;
|
||||
};
|
||||
|
||||
HRESULT d2d_gradient_init(struct d2d_gradient *gradient, ID2D1RenderTarget *render_target,
|
||||
HRESULT d2d_gradient_init(struct d2d_gradient *gradient, ID2D1Factory *factory,
|
||||
const D2D1_GRADIENT_STOP *stops, UINT32 stop_count, D2D1_GAMMA gamma,
|
||||
D2D1_EXTEND_MODE extend_mode) DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
|
@ -462,6 +462,7 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateGradientStopCollect
|
|||
const D2D1_GRADIENT_STOP *stops, UINT32 stop_count, D2D1_GAMMA gamma, D2D1_EXTEND_MODE extend_mode,
|
||||
ID2D1GradientStopCollection **gradient)
|
||||
{
|
||||
struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface);
|
||||
struct d2d_gradient *object;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -471,7 +472,7 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateGradientStopCollect
|
|||
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (FAILED(hr = d2d_gradient_init(object, iface, stops, stop_count, gamma, extend_mode)))
|
||||
if (FAILED(hr = d2d_gradient_init(object, render_target->factory, stops, stop_count, gamma, extend_mode)))
|
||||
{
|
||||
WARN("Failed to initialize gradient, hr %#x.\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
|
|
Loading…
Reference in New Issue