File 0008-d2d1-remove-extraneous-checks-for-last-vertex.patch of Package wine
From ba90e29ced9436d558ae77aa010fc1af65057a02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sat, 1 Jan 2022 02:35:00 +0100
Subject: [PATCH 08/10] d2d1: remove extraneous checks for last vertex
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The very last vertex of a figure can only be a of type LINE
(non-coincident last/first vertices) or type END (otherwise).
In case the current vertex starts a bezier path, there is always
at least one more vertex, i.e. (vertex_idx + 1) < vertex_count
is always true.
Signed-off-by: Stefan BrĂ¼ns <stefan.bruens@rwth-aachen.de>
---
dlls/d2d1/geometry.c | 23 ++---------------------
1 file changed, 2 insertions(+), 21 deletions(-)
diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c
index d60ea4e4afd..61952fdf782 100644
--- a/dlls/d2d1/geometry.c
+++ b/dlls/d2d1/geometry.c
@@ -2007,8 +2007,6 @@ static BOOL d2d_geometry_intersect_bezier_line(struct d2d_geometry *geometry,
p[0] = &figure->vertices[idx_p->vertex_idx];
p[1] = &figure->bezier_controls[idx_p->control_idx];
next = idx_p->vertex_idx + 1;
- if (next == figure->vertex_count)
- next = 0;
p[2] = &figure->vertices[next];
figure = &geometry->u.path.figures[idx_q->figure_idx];
@@ -2085,16 +2083,12 @@ static BOOL d2d_geometry_intersect_bezier_bezier(struct d2d_geometry *geometry,
p[0] = &figure->vertices[idx_p->vertex_idx];
p[1] = &figure->bezier_controls[idx_p->control_idx];
next = idx_p->vertex_idx + 1;
- if (next == figure->vertex_count)
- next = 0;
p[2] = &figure->vertices[next];
figure = &geometry->u.path.figures[idx_q->figure_idx];
q[0] = &figure->vertices[idx_q->vertex_idx];
q[1] = &figure->bezier_controls[idx_q->control_idx];
next = idx_q->vertex_idx + 1;
- if (next == figure->vertex_count)
- next = 0;
q[2] = &figure->vertices[next];
d2d_rect_get_bezier_segment_bounds(&p_bounds, p[0], p[1], p[2], start_p, end_p);
@@ -2178,8 +2172,6 @@ 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];
next = inter->vertex_idx + vertex_offset + 1;
- if (next == figure->vertex_count)
- next = 0;
p[2] = &figure->vertices[next];
d2d_point_lerp(&q[0], p[0], p[1], t);
@@ -3014,18 +3006,12 @@ static BOOL d2d_geometry_check_bezier_overlap(struct d2d_geometry *geometry,
figure = &geometry->u.path.figures[idx_p->figure_idx];
a[0] = &figure->vertices[idx_p->vertex_idx];
a[1] = &figure->bezier_controls[idx_p->control_idx];
- if (idx_p->vertex_idx == figure->vertex_count - 1)
- a[2] = &figure->vertices[0];
- else
- a[2] = &figure->vertices[idx_p->vertex_idx + 1];
+ a[2] = &figure->vertices[idx_p->vertex_idx + 1];
figure = &geometry->u.path.figures[idx_q->figure_idx];
b[0] = &figure->vertices[idx_q->vertex_idx];
b[1] = &figure->bezier_controls[idx_q->control_idx];
- if (idx_q->vertex_idx == figure->vertex_count - 1)
- b[2] = &figure->vertices[0];
- else
- b[2] = &figure->vertices[idx_q->vertex_idx + 1];
+ b[2] = &figure->vertices[idx_q->vertex_idx + 1];
if (d2d_point_ccw(a[0], a[1], a[2]) == 0.0f || d2d_point_ccw(b[0], b[1], b[2]) == 0.0f)
return FALSE;
@@ -3095,9 +3081,6 @@ static float d2d_geometry_bezier_ccw(struct d2d_geometry *geometry, const struct
const struct d2d_figure *figure = &geometry->u.path.figures[idx->figure_idx];
size_t next = idx->vertex_idx + 1;
- if (next == figure->vertex_count)
- next = 0;
-
return d2d_point_ccw(&figure->vertices[idx->vertex_idx],
&figure->bezier_controls[idx->control_idx], &figure->vertices[next]);
}
@@ -3113,8 +3096,6 @@ static BOOL d2d_geometry_split_bezier(struct d2d_geometry *geometry, const struc
p[0] = &figure->vertices[idx->vertex_idx];
p[1] = &figure->bezier_controls[idx->control_idx];
next = idx->vertex_idx + 1;
- if (next == figure->vertex_count)
- next = 0;
p[2] = &figure->vertices[next];
d2d_point_lerp(&q[0], p[0], p[1], 0.5f);
--
2.34.1