Update d2d_geometry_apply_intersections to now handle cubic beziers.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d2d1/geometry.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c index 05b1d10ed8..5e62ea8422 100644 --- a/dlls/d2d1/geometry.c +++ b/dlls/d2d1/geometry.c @@ -2112,9 +2112,10 @@ static BOOL d2d_geometry_apply_intersections(struct d2d_geometry *geometry, size_t vertex_offset, control_offset, next, i; struct d2d_geometry_intersection *inter; enum d2d_vertex_type vertex_type; - const D2D1_POINT_2F *p[3]; + const D2D1_POINT_2F *p[4]; + D2D1_POINT_2F cq0; struct d2d_figure *figure; - D2D1_POINT_2F q[2], c[2]; + D2D1_BEZIER_SEGMENT b[2]; float t, t_prev;
for (i = 0; i < intersections->intersection_count; ++i) @@ -2148,22 +2149,23 @@ static BOOL d2d_geometry_apply_intersections(struct d2d_geometry *geometry, }
p[0] = &figure->vertices[inter->vertex_idx + vertex_offset]; - p[1] = &figure->bezier_controls[inter->control_idx + control_offset].cq0; + p[1] = &figure->bezier_controls[inter->control_idx + control_offset].c0; + p[2] = &figure->bezier_controls[inter->control_idx + control_offset].c1; next = inter->vertex_idx + vertex_offset + 1; if (next == figure->vertex_count) next = 0; - p[2] = &figure->vertices[next]; + p[3] = &figure->vertices[next];
- d2d_point_lerp(&q[0], p[0], p[1], t); - d2d_point_lerp(&q[1], p[1], p[2], t); + d2d_cubic_bezier_split(p[0], p[1], p[2], p[3], t, &b[0], &b[1], NULL);
- d2d_bezier_quad_to_cubic(p[0], &q[0], &inter->p, &c[0], &c[1]); - figure->bezier_controls[inter->control_idx + control_offset].cq0 = q[0]; - figure->bezier_controls[inter->control_idx + control_offset].c0 = c[0]; - figure->bezier_controls[inter->control_idx + control_offset].c1 = c[1]; + d2d_bezier_cubic_to_quad(p[0], &b[0].point1, &b[0].point2, &inter->p, &cq0); + figure->bezier_controls[inter->control_idx + control_offset].c0 = b[0].point1; + figure->bezier_controls[inter->control_idx + control_offset].c1 = b[0].point2; + figure->bezier_controls[inter->control_idx + control_offset].cq0 = cq0;
- d2d_bezier_quad_to_cubic(&inter->p, &q[1], p[2], &c[0], &c[1]); - if (!(d2d_figure_insert_bezier_control(figure, inter->control_idx + control_offset + 1, &c[0], &c[1], &q[1]))) + d2d_bezier_cubic_to_quad(&inter->p, &b[1].point1, &b[1].point2, p[3], &cq0); + if (!(d2d_figure_insert_bezier_control(figure, inter->control_idx + control_offset + 1, &b[1].point1, + &b[1].point2, &cq0))) return FALSE; ++control_offset;