On 14 September 2017 at 14:10, Nikolay Sivov <nsivov(a)codeweavers.com> wrote:
> + /* GetBounds() with bezier segments. */
> + 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);
> + fill_geometry_sink_bezier(sink);
> + hr = ID2D1GeometrySink_Close(sink);
> + ok(SUCCEEDED(hr), "Failed to close geometry sink, hr %#x.\n", hr);
> + ID2D1GeometrySink_Release(sink);
> +
> + set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
> + hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
> + ok(SUCCEEDED(hr), "Failed to get geometry bounds, hr %#x.\n", hr);
> + match = compare_rect(&rect, 5.0f, 20.0f, 75.0f, 752.0f, 0);
> + ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
> + rect.left, rect.top, rect.right, rect.bottom);
Note that the way fill_geometry_sink_bezier() is constructed, the
bounds tend to coincide with the control points, probably even under a
carefully chosen rotation. The figure from test_bezier_intersect()
under various rotations may be more interesting.