Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d2d1/tests/d2d1.c | 72 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index a3fe5f10a8..7426a793c0 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -8256,6 +8256,78 @@ static void test_bezier_intersect(void) "c9EBcdQBb9YBbNkBatsBaN0BZeEBYuQBX+gBW+0BVvEBUvUBTvwBR4QCQIoCOZgCK6oCGQIA"); ok(match, "Figure does not match.\n");
+ /* Cubic bezier figure with a single line-bezier intersection and multiple + * double line-bezier intersections. */ + hr = ID2D1Factory_CreatePathGeometry(factory, &geometry); + ok(SUCCEEDED(hr), "Failed to create path geometry, hr %#x.\n", hr); + hr = ID2D1PathGeometry_Open(geometry, &sink); + ok(SUCCEEDED(hr), "Failed to open geometry sink, hr %#x.\n", hr); + + set_point(&point, 50.0f, 120.0f); + ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED); + cubic_to(sink, 100.0f, 20.0f, 150.0f, 220.0f, 200.0f, 120.0f); + cubic_to(sink, 150.0f, 320.0f, 250.0f, 520.0f, 200.0f, 720.0f); + cubic_to(sink, 150.0f, 620.0f, 100.0f, 820.0f, 50.0f, 720.0f); + cubic_to(sink, 0.0f, 520.0f, 100.0f, 320.0f, 50.0f, 120.0f); + ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED); + + set_point(&point, 40.0f, 80.0f); + ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED); + line_to(sink, 180.0f, 80.0f); + line_to(sink, 180.0f, 720.0f); + line_to(sink, 40.0f, 720.0f); + + ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED); + + hr = ID2D1GeometrySink_Close(sink); + ok(SUCCEEDED(hr), "Failed to close geometry sink, hr %#x.\n", hr); + ID2D1GeometrySink_Release(sink); + + ID2D1RenderTarget_BeginDraw(rt); + set_color(&color, 1.0f, 1.0f, 1.0f, 1.0f); + set_color(&color, 0.396f, 0.180f, 0.537f, 1.0f); + ID2D1RenderTarget_Clear(rt, &color); + ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL); + hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to end draw, hr %#x.\n", hr); + ID2D1PathGeometry_Release(geometry); + + /* Cubic bezier figure with a line-bezier intersection of 3 points within + * one line and one bezier segment. */ + hr = ID2D1Factory_CreatePathGeometry(factory, &geometry); + ok(SUCCEEDED(hr), "Failed to create path geometry, hr %#x.\n", hr); + hr = ID2D1PathGeometry_Open(geometry, &sink); + ok(SUCCEEDED(hr), "Failed to open geometry sink, hr %#x.\n", hr); + + set_point(&point, 50.0f, 120.0f); + ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED); + cubic_to(sink, 100.0f, 20.0f, 150.0f, 220.0f, 200.0f, 120.0f); + cubic_to(sink, 150.0f, 320.0f, 250.0f, 520.0f, 200.0f, 720.0f); + cubic_to(sink, 150.0f, 620.0f, 100.0f, 820.0f, 50.0f, 720.0f); + cubic_to(sink, 0.0f, 520.0f, 100.0f, 320.0f, 50.0f, 120.0f); + ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED); + + set_point(&point, 20.0f, 20.0f); + ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED); + line_to(sink, 180.0f, 80.0f); + line_to(sink, 220.0f, 900.0f); + line_to(sink, 20.0f, 900.0f); + + ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED); + + hr = ID2D1GeometrySink_Close(sink); + ok(SUCCEEDED(hr), "Failed to close geometry sink, hr %#x.\n", hr); + ID2D1GeometrySink_Release(sink); + + ID2D1RenderTarget_BeginDraw(rt); + set_color(&color, 1.0f, 1.0f, 1.0f, 1.0f); + set_color(&color, 0.396f, 0.180f, 0.537f, 1.0f); + ID2D1RenderTarget_Clear(rt, &color); + ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL); + hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to end draw, hr %#x.\n", hr); + ID2D1PathGeometry_Release(geometry); + ID2D1SolidColorBrush_Release(brush); ID2D1RenderTarget_Release(rt); refcount = ID2D1Factory_Release(factory);