| 617 | } |
| 618 | |
| 619 | void VirtualPath::copy( |
| 620 | const SplitPathCoord& first, |
| 621 | const SplitPathCoord& last, |
| 622 | MapCoordVector& out_coords ) const |
| 623 | { |
| 624 | Q_ASSERT(!empty()); |
| 625 | Q_ASSERT(first.path_coords == &path_coords); |
| 626 | Q_ASSERT(last.path_coords == &path_coords); |
| 627 | |
| 628 | auto& flags = coords.flags; |
| 629 | |
| 630 | // Handle first coordinate and its flags. |
| 631 | if (out_coords.empty() || |
| 632 | out_coords.back().isHolePoint() || |
| 633 | !out_coords.back().isPositionEqualTo(MapCoord(first.pos)) ) |
| 634 | { |
| 635 | out_coords.emplace_back(first.pos); |
| 636 | } |
| 637 | |
| 638 | auto first_flags = out_coords.back().flags() & MapCoord::MaskCopiedFlagsAtStart; |
| 639 | if (first.param == 0.0f) |
| 640 | first_flags |= flags[first.index].flags() & MapCoord::MaskCopiedFlagsAtStart; |
| 641 | out_coords.back().setFlags(first_flags); |
| 642 | |
| 643 | if (first.index == last.index) |
| 644 | { |
| 645 | out_coords.back().setCurveStart(last.is_curve_end && last.param != first.param); |
| 646 | } |
| 647 | else |
| 648 | { |
| 649 | out_coords.back().setCurveStart(first.is_curve_start); |
| 650 | |
| 651 | auto stop_index = last.index; |
| 652 | if (last.param == 0.0f) |
| 653 | { |
| 654 | stop_index -= last.is_curve_end ? 3 : 1; |
| 655 | } |
| 656 | |
| 657 | auto index = first.index + 1; |
| 658 | if (first.is_curve_start) |
| 659 | { |
| 660 | out_coords.emplace_back(first.curve_start[0]); |
| 661 | out_coords.emplace_back(first.curve_start[1]); |
| 662 | index += 2; |
| 663 | } |
| 664 | |
| 665 | for (; index <= stop_index; ++index) |
| 666 | { |
| 667 | out_coords.emplace_back(coords[index]); |
| 668 | out_coords.back().setFlags(flags[index].flags()); |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | if (out_coords.back().isCurveStart()) |
| 673 | { |
| 674 | Q_ASSERT(last.is_curve_end); |
| 675 | out_coords.emplace_back(last.curve_end[0]); |
| 676 | out_coords.emplace_back(last.curve_end[1]); |
no test coverage detected