d2d1: Do not fill hollow figures.

Signed-off-by: Giovanni Mascellani <gio@debian.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Giovanni Mascellani 2020-01-30 17:36:40 +03:30 committed by Alexandre Julliard
parent 7065819956
commit b728b2ff5f
3 changed files with 15 additions and 8 deletions

View File

@ -942,6 +942,7 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t
if (geometry->fill.bezier_vertex_count)
{
buffer_desc.ByteWidth = geometry->fill.bezier_vertex_count * sizeof(*geometry->fill.bezier_vertices);
buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER;
buffer_data.pSysMem = geometry->fill.bezier_vertices;
if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb)))

View File

@ -1548,6 +1548,9 @@ static BOOL d2d_cdt_insert_segments(struct d2d_cdt *cdt, struct d2d_geometry *ge
{
figure = &geometry->u.path.figures[i];
if (figure->flags & D2D_FIGURE_FLAG_HOLLOW)
continue;
/* Degenerate figure. */
if (figure->vertex_count < 2)
continue;
@ -2011,6 +2014,8 @@ static HRESULT d2d_path_geometry_triangulate(struct d2d_geometry *geometry)
for (i = 0, vertex_count = 0; i < geometry->u.path.figure_count; ++i)
{
if (geometry->u.path.figures[i].flags & D2D_FIGURE_FLAG_HOLLOW)
continue;
vertex_count += geometry->u.path.figures[i].vertex_count;
}
@ -2025,6 +2030,8 @@ static HRESULT d2d_path_geometry_triangulate(struct d2d_geometry *geometry)
for (i = 0, j = 0; i < geometry->u.path.figure_count; ++i)
{
if (geometry->u.path.figures[i].flags & D2D_FIGURE_FLAG_HOLLOW)
continue;
memcpy(&vertices[j], geometry->u.path.figures[i].vertices,
geometry->u.path.figures[i].vertex_count * sizeof(*vertices));
j += geometry->u.path.figures[i].vertex_count;
@ -2455,9 +2462,6 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_BeginFigure(ID2D1GeometrySink *i
return;
}
if (figure_begin != D2D1_FIGURE_BEGIN_FILLED)
FIXME("Ignoring figure_begin %#x.\n", figure_begin);
if (!d2d_path_geometry_add_figure(geometry))
{
ERR("Failed to add figure.\n");
@ -2620,7 +2624,7 @@ static BOOL d2d_geometry_get_bezier_segment_idx(struct d2d_geometry *geometry, s
{
struct d2d_figure *figure = &geometry->u.path.figures[idx->figure_idx];
if (!figure->bezier_control_count)
if (!figure->bezier_control_count || figure->flags & D2D_FIGURE_FLAG_HOLLOW)
continue;
for (; idx->vertex_idx < figure->vertex_count; ++idx->vertex_idx)
@ -2816,6 +2820,8 @@ static HRESULT d2d_geometry_resolve_beziers(struct d2d_geometry *geometry)
for (i = 0; i < geometry->u.path.figure_count; ++i)
{
if (geometry->u.path.figures[i].flags & D2D_FIGURE_FLAG_HOLLOW)
continue;
geometry->fill.bezier_vertex_count += 3 * geometry->u.path.figures[i].bezier_control_count;
}

View File

@ -7480,13 +7480,13 @@ static void test_fill_geometry(void)
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");
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");
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");
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");
ok(match, "Figure does not match.\n");
ID2D1SolidColorBrush_Release(brush);
ID2D1RenderTarget_Release(rt);