From 5f4bba4303ebce3f220ddcab8b7d11be18902151 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 28 Oct 2016 09:51:06 +0300 Subject: [PATCH] d2d1: Store gradient stop collection pointer for linear gradient brush. Signed-off-by: Nikolay Sivov Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d2d1/brush.c | 10 ++++++++-- dlls/d2d1/d2d1_private.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index 87259928459..4110b487764 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -373,7 +373,10 @@ static ULONG STDMETHODCALLTYPE d2d_linear_gradient_brush_Release(ID2D1LinearGrad TRACE("%p decreasing refcount to %u.\n", iface, refcount); if (!refcount) + { + ID2D1GradientStopCollection_Release(brush->u.linear.gradient); d2d_brush_destroy(brush); + } return refcount; } @@ -465,9 +468,11 @@ static D2D1_POINT_2F * STDMETHODCALLTYPE d2d_linear_gradient_brush_GetEndPoint(I static void STDMETHODCALLTYPE d2d_linear_gradient_brush_GetGradientStopCollection(ID2D1LinearGradientBrush *iface, ID2D1GradientStopCollection **gradient) { - FIXME("iface %p, gradient %p stub!\n", iface, gradient); + struct d2d_brush *brush = impl_from_ID2D1LinearGradientBrush(iface); - *gradient = NULL; + TRACE("iface %p, gradient %p.\n", iface, gradient); + + ID2D1GradientStopCollection_AddRef(*gradient = brush->u.linear.gradient); } static const struct ID2D1LinearGradientBrushVtbl d2d_linear_gradient_brush_vtbl = @@ -496,6 +501,7 @@ HRESULT d2d_linear_gradient_brush_create(ID2D1Factory *factory, const D2D1_LINEA d2d_brush_init(*brush, factory, D2D_BRUSH_TYPE_LINEAR, brush_desc, (ID2D1BrushVtbl *)&d2d_linear_gradient_brush_vtbl); (*brush)->u.linear.desc = *gradient_brush_desc; + ID2D1GradientStopCollection_AddRef((*brush)->u.linear.gradient = gradient); TRACE("Created brush %p.\n", *brush); return S_OK; diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index f8c0d452778..021a703d2c6 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -199,6 +199,7 @@ struct d2d_brush struct { D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES desc; + ID2D1GradientStopCollection *gradient; } linear; } u; };