Commit 2e08bc0f authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

d2d1: Implement d2d_path_geometry_FillContainsPoint().

parent 930dd951
......@@ -357,4 +357,27 @@ static inline void d2d_matrix_multiply(D2D_MATRIX_3X2_F *a, const D2D_MATRIX_3X2
a->_32 = tmp._31 * b->_12 + tmp._32 * b->_22 + b->_32;
}
/* Dst must be different from src. */
static inline BOOL d2d_matrix_invert(D2D_MATRIX_3X2_F *dst, const D2D_MATRIX_3X2_F *src)
{
float d = src->_11 * src->_22 - src->_21 * src->_12;
if (d == 0.0f)
return FALSE;
dst->_11 = src->_22 / d;
dst->_21 = -src->_21 / d;
dst->_31 = (src->_21 * src->_32 - src->_31 * src->_22) / d;
dst->_12 = -src->_12 / d;
dst->_22 = src->_11 / d;
dst->_32 = -(src->_11 * src->_32 - src->_31 * src->_12) / d;
return TRUE;
}
static inline void d2d_point_transform(D2D1_POINT_2F *dst, const D2D1_MATRIX_3X2_F *matrix, float x, float y)
{
dst->x = x * matrix->_11 + y * matrix->_21 + matrix->_31;
dst->y = x * matrix->_12 + y * matrix->_22 + matrix->_32;
}
#endif /* __WINE_D2D1_PRIVATE_H */
......@@ -1924,9 +1924,11 @@ static HRESULT STDMETHODCALLTYPE d2d_geometry_sink_Close(ID2D1GeometrySink *ifac
}
done:
d2d_path_geometry_free_figures(geometry);
if (FAILED(hr))
{
d2d_path_geometry_free_figures(geometry);
geometry->u.path.state = D2D_GEOMETRY_STATE_ERROR;
}
return hr;
}
......@@ -2112,10 +2114,24 @@ static HRESULT STDMETHODCALLTYPE d2d_path_geometry_StrokeContainsPoint(ID2D1Path
static HRESULT STDMETHODCALLTYPE d2d_path_geometry_FillContainsPoint(ID2D1PathGeometry *iface,
D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F *transform, float tolerance, BOOL *contains)
{
FIXME("iface %p, point {%.8e, %.8e}, transform %p, tolerance %.8e, contains %p stub!\n",
struct d2d_geometry *geometry = impl_from_ID2D1PathGeometry(iface);
D2D1_MATRIX_3X2_F g_i;
TRACE("iface %p, point {%.8e, %.8e}, transform %p, tolerance %.8e, contains %p.\n",
iface, point.x, point.y, transform, tolerance, contains);
return E_NOTIMPL;
if (transform)
{
if (!d2d_matrix_invert(&g_i, transform))
return D2DERR_UNSUPPORTED_OPERATION;
d2d_point_transform(&point, &g_i, point.x, point.y);
}
*contains = !!d2d_path_geometry_point_inside(geometry, &point);
TRACE("-> %#x.\n", *contains);
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d2d_path_geometry_CompareWithGeometry(ID2D1PathGeometry *iface,
......
......@@ -48,12 +48,6 @@ static void d2d_point_set(D2D1_POINT_2F *dst, float x, float y)
dst->y = y;
}
static void d2d_point_transform(D2D1_POINT_2F *dst, const D2D1_MATRIX_3X2_F *matrix, float x, float y)
{
dst->x = x * matrix->_11 + y * matrix->_21 + matrix->_31;
dst->y = x * matrix->_12 + y * matrix->_22 + matrix->_32;
}
static void d2d_rect_expand(D2D1_RECT_F *dst, const D2D1_POINT_2F *point)
{
if (point->x < dst->left)
......
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