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

d2d1: Ensure that hollow figures do not impact geometry bounds.

parent fdd7604d
......@@ -3097,10 +3097,22 @@ static HRESULT STDMETHODCALLTYPE d2d_path_geometry_GetBounds(ID2D1PathGeometry *
if (!transform)
{
if (geometry->u.path.bounds.left > geometry->u.path.bounds.right)
if (geometry->u.path.bounds.left > geometry->u.path.bounds.right
&& !isinf(geometry->u.path.bounds.left))
{
for (i = 0; i < geometry->u.path.figure_count; ++i)
{
if (geometry->u.path.figures[i].flags & D2D_FIGURE_FLAG_HOLLOW)
continue;
d2d_rect_union(&geometry->u.path.bounds, &geometry->u.path.figures[i].bounds);
}
if (geometry->u.path.bounds.left > geometry->u.path.bounds.right)
{
geometry->u.path.bounds.left = INFINITY;
geometry->u.path.bounds.right = FLT_MAX;
geometry->u.path.bounds.top = INFINITY;
geometry->u.path.bounds.bottom = FLT_MAX;
}
}
*bounds = geometry->u.path.bounds;
......@@ -3115,6 +3127,9 @@ static HRESULT STDMETHODCALLTYPE d2d_path_geometry_GetBounds(ID2D1PathGeometry *
D2D1_POINT_2F p, p1, p2;
size_t j, bezier_idx;
if (figure->flags & D2D_FIGURE_FLAG_HOLLOW)
continue;
/* Single vertex figures are reduced by CloseFigure(). */
if (figure->vertex_count == 0)
{
......@@ -3181,6 +3196,14 @@ static HRESULT STDMETHODCALLTYPE d2d_path_geometry_GetBounds(ID2D1PathGeometry *
}
}
if (bounds->left > bounds->right)
{
bounds->left = INFINITY;
bounds->right = FLT_MAX;
bounds->top = INFINITY;
bounds->bottom = FLT_MAX;
}
return S_OK;
}
......
......@@ -3114,7 +3114,7 @@ static void test_path_geometry(void)
hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
ok(SUCCEEDED(hr), "Failed to get geometry bounds, hr %#x.\n", hr);
match = compare_rect(&rect, 5.0f, 472.0f, 75.0f, 752.0f, 0);
todo_wine ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
rect.left, rect.top, rect.right, rect.bottom);
set_matrix_identity(&matrix);
......@@ -3124,7 +3124,7 @@ static void test_path_geometry(void)
hr = ID2D1PathGeometry_GetBounds(geometry, &matrix, &rect);
ok(SUCCEEDED(hr), "Failed to get geometry bounds, hr %#x.\n", hr);
match = compare_rect(&rect, 90.0f, 876.0f, 230.0f, 1016.0f, 0);
todo_wine ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
rect.left, rect.top, rect.right, rect.bottom);
ID2D1PathGeometry_Release(geometry);
......@@ -3143,7 +3143,7 @@ static void test_path_geometry(void)
hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
ok(SUCCEEDED(hr), "Failed to get geometry bounds, hr %#x.\n", hr);
match = compare_rect(&rect, INFINITY, INFINITY, FLT_MAX, FLT_MAX, 0);
todo_wine ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
rect.left, rect.top, rect.right, rect.bottom);
set_matrix_identity(&matrix);
......@@ -3153,7 +3153,7 @@ static void test_path_geometry(void)
hr = ID2D1PathGeometry_GetBounds(geometry, &matrix, &rect);
ok(SUCCEEDED(hr), "Failed to get geometry bounds, hr %#x.\n", hr);
match = compare_rect(&rect, INFINITY, INFINITY, FLT_MAX, FLT_MAX, 0);
todo_wine ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
rect.left, rect.top, rect.right, rect.bottom);
ID2D1PathGeometry_Release(geometry);
......
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