[PATCH 5/5] d2d1: Implement d2d_gradient_GetFactory().
Henri Verbeet
hverbeet at codeweavers.com
Sun Aug 2 11:56:09 CDT 2015
---
dlls/d2d1/brush.c | 10 +++++++---
dlls/d2d1/d2d1_private.h | 3 ++-
dlls/d2d1/render_target.c | 3 ++-
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c
index a2227fa..bf8746a 100644
--- a/dlls/d2d1/brush.c
+++ b/dlls/d2d1/brush.c
@@ -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);
+
+ TRACE("iface %p, factory %p.\n", iface, factory);
- *factory = NULL;
+ 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))))
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index ebc97fc..3f2ac3e 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -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;
diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c
index 6737948..99cb7c8 100644
--- a/dlls/d2d1/render_target.c
+++ b/dlls/d2d1/render_target.c
@@ -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);
--
2.1.4
More information about the wine-patches
mailing list