On Freitag, 7. Januar 2022 18:10:27 CET you wrote:
On Fri, 7 Jan 2022 at 09:00, Stefan Brüns <stefan.bruens(a)rwth-aachen.de> wrote:
- prev_type = figure->vertex_types[figure->vertex_count - 1]; - if (d2d_vertex_type_is_bezier(prev_type)) - prev = &figure->bezier_controls[figure->bezier_control_count - 1]; - else - prev = &figure->vertices[figure->vertex_count - 1]; + next_prev = next = &figure->bezier_controls[bezier_idx++]; + /* type BEZIER implies i + 1 < figure->vertex_count */ + p1 = &figure->vertices[i + 1]; +
Is that already true at this point in the series? It would be true after patch 6/8 in this series, but at this point in the series the end point could still have been removed in d2d_geometry_sink_EndFigure(), right?
The code is valid. Either the last and first vertex is not cooincident, then the last segment is a line. Or they are coincident, but he figure is OPEN. Then again the last segment is a line. Or they are coincident, the figure is CLOSED, thus vertex_count is decremented. Then the last segment starts a `i == vertex_count - 1 == real_vertex_count - 2`. As `vertex[i + 1] == vertex[0]` holds, we can ignore the wraparound. The comment is slightly off in this case - maybe `i + 1 < real_vertex_count`, but I am not sure this is really relevant, as this becomes fully correct with patch 6. Kind regards, Stefan -- Stefan Brüns / Bergstraße 21 / 52062 Aachen home: +49 241 53809034 mobile: +49 151 50412019