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

d2d1/tests: Check that hollow figures are not filled.

parent cf94f774
......@@ -7410,6 +7410,84 @@ static void test_fill_geometry(void)
"sQIMswILtQIIhs4B");
ok(match, "Figure does not match.\n");
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, -0.402914f, 0.915514f);
ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
quadratic_to(sink, -0.310379f, 0.882571f, -0.116057f, 0.824000f);
quadratic_to(sink, 0.008350f, 0.693614f, -0.052343f, 0.448886f);
quadratic_to(sink, -0.154236f, 0.246072f, -0.279229f, 0.025343f);
quadratic_to(sink, -0.370064f, -0.588586f, -0.383029f, -0.924114f);
quadratic_to(sink, -0.295479f, -0.958764f, -0.017086f, -0.988400f);
quadratic_to(sink, 0.208836f, -0.954157f, 0.272200f, -0.924114f);
quadratic_to(sink, 0.295614f, -0.569071f, 0.230143f, 0.022886f);
quadratic_to(sink, 0.101664f, 0.220643f, 0.012057f, 0.451571f);
quadratic_to(sink, -0.028764f, 0.709014f, 0.104029f, 0.833943f);
quadratic_to(sink, 0.319414f, 0.913057f, 0.403229f, 0.942628f);
quadratic_to(sink, 0.317721f, 1.023450f, -0.017086f, 1.021771f);
quadratic_to(sink, -0.310843f, 1.007472f, -0.402914f, 0.915514f);
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);
set_matrix_identity(&matrix);
translate_matrix(&matrix, 40.0f, 160.0f);
scale_matrix(&matrix, 20.0f, 80.0f);
hr = ID2D1Factory_CreateTransformedGeometry(factory,
(ID2D1Geometry *)geometry, &matrix, &transformed_geometry[0]);
ok(SUCCEEDED(hr), "Failed to create geometry, hr %#x.\n", hr);
set_matrix_identity(&matrix);
translate_matrix(&matrix, 160.0f, 640.0f);
scale_matrix(&matrix, 40.0f, 160.0f);
rotate_matrix(&matrix, M_PI / -5.0f);
hr = ID2D1Factory_CreateTransformedGeometry(factory,
(ID2D1Geometry *)geometry, &matrix, &transformed_geometry[1]);
ok(SUCCEEDED(hr), "Failed to create geometry, hr %#x.\n", hr);
ID2D1PathGeometry_Release(geometry);
set_matrix_identity(&matrix);
scale_matrix(&matrix, 0.5f, 1.0f);
translate_matrix(&matrix, -80.0f, 0.0f);
hr = ID2D1Factory_CreateTransformedGeometry(factory,
(ID2D1Geometry *)transformed_geometry[1], &matrix, &transformed_geometry[2]);
ok(SUCCEEDED(hr), "Failed to create geometry, hr %#x.\n", hr);
set_matrix_identity(&matrix);
rotate_matrix(&matrix, M_PI / 2.0f);
translate_matrix(&matrix, 80.0f, -320.0f);
scale_matrix(&matrix, 2.0f, 0.25f);
hr = ID2D1Factory_CreateTransformedGeometry(factory,
(ID2D1Geometry *)transformed_geometry[2], &matrix, &transformed_geometry[3]);
ok(SUCCEEDED(hr), "Failed to create geometry, hr %#x.\n", hr);
ID2D1RenderTarget_BeginDraw(rt);
ID2D1RenderTarget_Clear(rt, &color);
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[0], (ID2D1Brush *)brush, NULL);
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[1], (ID2D1Brush *)brush, NULL);
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[2], (ID2D1Brush *)brush, NULL);
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[3], (ID2D1Brush *)brush, NULL);
hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
ok(SUCCEEDED(hr), "Failed to end draw, hr %#x.\n", hr);
ID2D1TransformedGeometry_Release(transformed_geometry[3]);
ID2D1TransformedGeometry_Release(transformed_geometry[2]);
ID2D1TransformedGeometry_Release(transformed_geometry[1]);
ID2D1TransformedGeometry_Release(transformed_geometry[0]);
match = compare_figure(surface, 0, 0, 160, 160, 0xff652e89, 0, "gMgB");
todo_wine ok(match, "Figure does not match.\n");
match = compare_figure(surface, 160, 0, 320, 160, 0xff652e89, 0, "gJAD");
todo_wine ok(match, "Figure does not match.\n");
match = compare_figure(surface, 0, 160, 160, 320, 0xff652e89, 0, "gJAD");
todo_wine ok(match, "Figure does not match.\n");
match = compare_figure(surface, 160, 160, 320, 320, 0xff652e89, 0, "gKAG");
todo_wine ok(match, "Figure does not match.\n");
ID2D1SolidColorBrush_Release(brush);
ID2D1RenderTarget_Release(rt);
refcount = ID2D1Factory_Release(factory);
......
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