@@ -253,7 +253,6 @@ StrokePathGeometry::CreateSolidStrokeVertices(
253
253
for (size_t contour_i = 0 ; contour_i < polyline.contours .size ();
254
254
contour_i++) {
255
255
auto contour = polyline.contours [contour_i];
256
- size_t contour_component_i = 0 ;
257
256
size_t contour_start_point_i, contour_end_point_i;
258
257
std::tie (contour_start_point_i, contour_end_point_i) =
259
258
polyline.GetContourPointBounds (contour_i);
@@ -309,55 +308,27 @@ StrokePathGeometry::CreateSolidStrokeVertices(
309
308
// Generate contour geometry.
310
309
for (size_t point_i = contour_start_point_i + 1 ;
311
310
point_i < contour_end_point_i; point_i++) {
312
- if ((contour_component_i + 1 >= contour.components .size ()) &&
313
- contour.components [contour_component_i + 1 ].component_start_index <=
314
- point_i) {
315
- // The point_i has entered the next component in this contour.
316
- contour_component_i += 1 ;
317
- }
318
311
// Generate line rect.
319
312
vtx.position = polyline.points [point_i - 1 ] + offset;
320
313
vtx_builder.AppendVertex (vtx);
321
314
vtx.position = polyline.points [point_i - 1 ] - offset;
322
315
vtx_builder.AppendVertex (vtx);
316
+ vtx.position = polyline.points [point_i] + offset;
317
+ vtx_builder.AppendVertex (vtx);
318
+ vtx.position = polyline.points [point_i] - offset;
319
+ vtx_builder.AppendVertex (vtx);
323
320
324
- auto is_end_of_contour = point_i == contour_end_point_i - 1 ;
325
-
326
- if (!contour.components [contour_component_i].is_curve ) {
327
- // For line components, two additional points need to be appended prior
328
- // to appending a join connecting the next component.
329
- vtx.position = polyline.points [point_i] + offset;
330
- vtx_builder.AppendVertex (vtx);
331
- vtx.position = polyline.points [point_i] - offset;
332
- vtx_builder.AppendVertex (vtx);
321
+ if (point_i < contour_end_point_i - 1 ) {
322
+ compute_offset (point_i + 1 );
333
323
334
- if (!is_end_of_contour) {
335
- compute_offset (point_i + 1 );
336
- // Generate join from the current line to the next line.
337
- join_proc (vtx_builder, polyline.points [point_i], previous_offset,
338
- offset, scaled_miter_limit, scale);
339
- }
340
- } else {
341
- // For curve components, the polyline is detailed enough such that
342
- // it can avoid worrying about joins altogether.
343
- if (!is_end_of_contour) {
344
- compute_offset (point_i + 1 );
345
- } else {
346
- // If this is a curve and is the end of the contour, two end points
347
- // need to be drawn with the contour end_direction.
348
- auto end_offset =
349
- Vector2 (-contour.end_direction .y , contour.end_direction .x ) *
350
- stroke_width * 0.5 ;
351
- vtx.position = polyline.points [contour_end_point_i - 1 ] + end_offset;
352
- vtx_builder.AppendVertex (vtx);
353
- vtx.position = polyline.points [contour_end_point_i - 1 ] - end_offset;
354
- vtx_builder.AppendVertex (vtx);
355
- }
324
+ // Generate join from the current line to the next line.
325
+ join_proc (vtx_builder, polyline.points [point_i], previous_offset,
326
+ offset, scaled_miter_limit, scale);
356
327
}
357
328
}
358
329
359
330
// Generate end cap or join.
360
- if (!contour .is_closed ) {
331
+ if (!polyline. contours [contour_i] .is_closed ) {
361
332
auto cap_offset =
362
333
Vector2 (-contour.end_direction .y , contour.end_direction .x ) *
363
334
stroke_width * 0.5 ; // Clockwise normal
0 commit comments