37 using difference_type = ptrdiff_t;
38 using pointer = value_type*;
39 using reference = value_type;
40 using iterator_category = std::input_iterator_tag;
41 Iterator(
const Contours& contours,
size_t index)
44 Iterator(
const Iterator& that) : Iterator{ that.fContours, that.fIndex } { }
45 Iterator& operator++() { ++fIndex;
return *
this; }
46 Iterator operator++(
int) { Iterator tmp(*
this); operator++();
return tmp; }
47 bool operator==(
const Iterator& rhs)
const {
return fIndex == rhs.fIndex; }
48 bool operator!=(
const Iterator& rhs)
const {
return fIndex != rhs.fIndex; }
49 value_type operator*() {
return fContours[fIndex]; }
50 friend difference_type operator-(Iterator lhs, Iterator rhs) {
51 return lhs.fIndex - rhs.fIndex;
64 auto& [bounds,
end] = fContours[i];
65 int32_t
start = i == 0 ? 0 : fContours[i-1].end;
71 return Iterator{*
this, 0};
74 Iterator
end()
const {
75 return Iterator{*
this, fContours.size()};
79 return fContours.size();
83 return fContours.empty();
86 std::vector<myers::Segment>
segments()
const;
90 struct CompactContour {
95 static Point RoundSkPoint(
SkPoint p);
96 bool currentContourIsEmpty()
const;
97 void addPointToCurrentContour(
SkPoint p);
98 void moveToStartOfContour(
SkPoint p);
99 void closeContourIfNeeded();
102 SkIRect fContourBounds = kEmptyRect;
104 std::vector<Point> fPoints;
105 std::vector<CompactContour> fContours;