Commit aec87013 authored by Giovanni Mascellani's avatar Giovanni Mascellani Committed by Alexandre Julliard

d2d1: Implement ellipse drawing.

Currently the ellipse is approximated with quadratic Bézier curves. Signed-off-by: 's avatarGiovanni Mascellani <gio@debian.org> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f04bcb2d
......@@ -467,6 +467,10 @@ struct d2d_geometry
{
struct
{
D2D1_ELLIPSE ellipse;
} ellipse;
struct
{
ID2D1GeometrySink ID2D1GeometrySink_iface;
struct d2d_figure *figures;
......@@ -501,6 +505,8 @@ struct d2d_geometry
} u;
};
HRESULT d2d_ellipse_geometry_init(struct d2d_geometry *geometry,
ID2D1Factory *factory, const D2D1_ELLIPSE *ellipse) DECLSPEC_HIDDEN;
void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory) DECLSPEC_HIDDEN;
HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry,
ID2D1Factory *factory, const D2D1_RECT_F *rect) DECLSPEC_HIDDEN;
......@@ -636,4 +642,12 @@ static inline const char *debug_d2d_rounded_rect(const D2D1_ROUNDED_RECT *rounde
rounded_rect->rect.right, rounded_rect->rect.bottom, rounded_rect->radiusX, rounded_rect->radiusY);
}
static inline const char *debug_d2d_ellipse(const D2D1_ELLIPSE *ellipse)
{
if (!ellipse)
return "(null)";
return wine_dbg_sprintf("(%.8e, %.8e)[%.8e, %.8e]",
ellipse->point.x, ellipse->point.y, ellipse->radiusX, ellipse->radiusY);
}
#endif /* __WINE_D2D1_PRIVATE_H */
......@@ -178,9 +178,25 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRoundedRectangleGeometry(ID2D
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateEllipseGeometry(ID2D1Factory2 *iface,
const D2D1_ELLIPSE *ellipse, ID2D1EllipseGeometry **geometry)
{
FIXME("iface %p, ellipse %p, geometry %p stub!\n", iface, ellipse, geometry);
struct d2d_geometry *object;
HRESULT hr;
return E_NOTIMPL;
TRACE("iface %p, ellipse %s, geometry %p.\n", iface, debug_d2d_ellipse(ellipse), geometry);
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d2d_ellipse_geometry_init(object, (ID2D1Factory *)iface, ellipse)))
{
WARN("Failed to initialize ellipse geometry, hr %#x.\n", hr);
heap_free(object);
return hr;
}
TRACE("Created ellipse geometry %p.\n", object);
*geometry = (ID2D1EllipseGeometry *)&object->ID2D1Geometry_iface;
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateGeometryGroup(ID2D1Factory2 *iface,
......
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