Commit 14c0009a authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d2d1: Implement d2d_path_geometry_GetFactory().

parent 9745efaf
...@@ -242,6 +242,8 @@ struct d2d_geometry ...@@ -242,6 +242,8 @@ struct d2d_geometry
ID2D1Geometry ID2D1Geometry_iface; ID2D1Geometry ID2D1Geometry_iface;
LONG refcount; LONG refcount;
ID2D1Factory *factory;
D2D1_POINT_2F *vertices; D2D1_POINT_2F *vertices;
size_t vertex_count; size_t vertex_count;
...@@ -273,8 +275,9 @@ struct d2d_geometry ...@@ -273,8 +275,9 @@ struct d2d_geometry
} u; } u;
}; };
void d2d_path_geometry_init(struct d2d_geometry *geometry) DECLSPEC_HIDDEN; void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory) DECLSPEC_HIDDEN;
HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, const D2D1_RECT_F *rect) DECLSPEC_HIDDEN; HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry,
ID2D1Factory *factory, const D2D1_RECT_F *rect) DECLSPEC_HIDDEN;
struct d2d_geometry *unsafe_impl_from_ID2D1Geometry(ID2D1Geometry *iface) DECLSPEC_HIDDEN; struct d2d_geometry *unsafe_impl_from_ID2D1Geometry(ID2D1Geometry *iface) DECLSPEC_HIDDEN;
static inline void d2d_matrix_multiply(D2D_MATRIX_3X2_F *a, const D2D_MATRIX_3X2_F *b) static inline void d2d_matrix_multiply(D2D_MATRIX_3X2_F *a, const D2D_MATRIX_3X2_F *b)
......
...@@ -102,7 +102,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRectangleGeometry(ID2D1Factor ...@@ -102,7 +102,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRectangleGeometry(ID2D1Factor
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d2d_rectangle_geometry_init(object, rect))) if (FAILED(hr = d2d_rectangle_geometry_init(object, iface, rect)))
{ {
WARN("Failed to initialize rectangle geometry, hr %#x.\n", hr); WARN("Failed to initialize rectangle geometry, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
...@@ -159,7 +159,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry(ID2D1Factory *if ...@@ -159,7 +159,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry(ID2D1Factory *if
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
d2d_path_geometry_init(object); d2d_path_geometry_init(object, iface);
TRACE("Created path geometry %p.\n", object); TRACE("Created path geometry %p.\n", object);
*geometry = (ID2D1PathGeometry *)&object->ID2D1Geometry_iface; *geometry = (ID2D1PathGeometry *)&object->ID2D1Geometry_iface;
......
...@@ -982,13 +982,16 @@ static void d2d_geometry_destroy(struct d2d_geometry *geometry) ...@@ -982,13 +982,16 @@ static void d2d_geometry_destroy(struct d2d_geometry *geometry)
HeapFree(GetProcessHeap(), 0, geometry->beziers); HeapFree(GetProcessHeap(), 0, geometry->beziers);
HeapFree(GetProcessHeap(), 0, geometry->faces); HeapFree(GetProcessHeap(), 0, geometry->faces);
HeapFree(GetProcessHeap(), 0, geometry->vertices); HeapFree(GetProcessHeap(), 0, geometry->vertices);
ID2D1Factory_Release(geometry->factory);
HeapFree(GetProcessHeap(), 0, geometry); HeapFree(GetProcessHeap(), 0, geometry);
} }
static void d2d_geometry_init(struct d2d_geometry *geometry, const struct ID2D1GeometryVtbl *vtbl) static void d2d_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory,
const struct ID2D1GeometryVtbl *vtbl)
{ {
geometry->ID2D1Geometry_iface.lpVtbl = vtbl; geometry->ID2D1Geometry_iface.lpVtbl = vtbl;
geometry->refcount = 1; geometry->refcount = 1;
ID2D1Factory_AddRef(geometry->factory = factory);
} }
static inline struct d2d_geometry *impl_from_ID2D1GeometrySink(ID2D1GeometrySink *iface) static inline struct d2d_geometry *impl_from_ID2D1GeometrySink(ID2D1GeometrySink *iface)
...@@ -1368,9 +1371,11 @@ static ULONG STDMETHODCALLTYPE d2d_path_geometry_Release(ID2D1PathGeometry *ifac ...@@ -1368,9 +1371,11 @@ static ULONG STDMETHODCALLTYPE d2d_path_geometry_Release(ID2D1PathGeometry *ifac
static void STDMETHODCALLTYPE d2d_path_geometry_GetFactory(ID2D1PathGeometry *iface, ID2D1Factory **factory) static void STDMETHODCALLTYPE d2d_path_geometry_GetFactory(ID2D1PathGeometry *iface, ID2D1Factory **factory)
{ {
FIXME("iface %p, factory %p stub!\n", iface, factory); struct d2d_geometry *geometry = impl_from_ID2D1PathGeometry(iface);
*factory = NULL; TRACE("iface %p, factory %p.\n", iface, factory);
ID2D1Factory_AddRef(*factory = geometry->factory);
} }
static HRESULT STDMETHODCALLTYPE d2d_path_geometry_GetBounds(ID2D1PathGeometry *iface, static HRESULT STDMETHODCALLTYPE d2d_path_geometry_GetBounds(ID2D1PathGeometry *iface,
...@@ -1567,9 +1572,9 @@ static const struct ID2D1PathGeometryVtbl d2d_path_geometry_vtbl = ...@@ -1567,9 +1572,9 @@ static const struct ID2D1PathGeometryVtbl d2d_path_geometry_vtbl =
d2d_path_geometry_GetFigureCount, d2d_path_geometry_GetFigureCount,
}; };
void d2d_path_geometry_init(struct d2d_geometry *geometry) void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory)
{ {
d2d_geometry_init(geometry, (ID2D1GeometryVtbl *)&d2d_path_geometry_vtbl); d2d_geometry_init(geometry, factory, (ID2D1GeometryVtbl *)&d2d_path_geometry_vtbl);
geometry->u.path.ID2D1GeometrySink_iface.lpVtbl = &d2d_geometry_sink_vtbl; geometry->u.path.ID2D1GeometrySink_iface.lpVtbl = &d2d_geometry_sink_vtbl;
} }
...@@ -1779,9 +1784,9 @@ static const struct ID2D1RectangleGeometryVtbl d2d_rectangle_geometry_vtbl = ...@@ -1779,9 +1784,9 @@ static const struct ID2D1RectangleGeometryVtbl d2d_rectangle_geometry_vtbl =
d2d_rectangle_geometry_GetRect, d2d_rectangle_geometry_GetRect,
}; };
HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, const D2D1_RECT_F *rect) HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory, const D2D1_RECT_F *rect)
{ {
d2d_geometry_init(geometry, (ID2D1GeometryVtbl *)&d2d_rectangle_geometry_vtbl); d2d_geometry_init(geometry, factory, (ID2D1GeometryVtbl *)&d2d_rectangle_geometry_vtbl);
geometry->u.rectangle.rect = *rect; geometry->u.rectangle.rect = *rect;
if (!(geometry->vertices = HeapAlloc(GetProcessHeap(), 0, 4 * sizeof(*geometry->vertices)))) if (!(geometry->vertices = HeapAlloc(GetProcessHeap(), 0, 4 * sizeof(*geometry->vertices))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment