63 {
65
66
67 fDeletionSet.clear();
68 fInsertionSet.clear();
69
70
71 bool hasLower = false;
72
73
74 auto handleLower = [&hasLower](const Lower& l) {
75 hasLower = true;
76 };
77
78
79 auto handleCross = [this](const Cross& c) {
80 fDeletionSet.insert({c.s0, c.s1});
81 fInsertionSet.insert({c.s0, c.s1});
82 };
83
84
85 auto handleUpper = [this](const Upper& u) {
86 fInsertionSet.insert(u.s);
87
88
89 SkASSERT(u.s.lower() != u.s.upper());
90 this->add(
Event{u.s.lower(), Lower{}});
91 };
92
93 Visitor visitor{handleLower, handleCross, handleUpper};
94
95 const Point eventPoint = fQueue.begin()->where;
96
97
98 SkASSERT(fLastEventPoint < eventPoint);
99 fLastEventPoint = eventPoint;
100
101
102 auto cursor = fQueue.begin();
103 const auto queueEnd = fQueue.end();
104 for (; cursor != queueEnd && cursor->where == eventPoint;
105 ++cursor) {
106 const Event&
event = *cursor;
107 std::visit(visitor,
event.type);
108 }
109
110
111 fQueue.erase(fQueue.begin(), cursor);
112
113 if (hasLower || !fDeletionSet.empty()) {
114
115 handler->handleDeletions(eventPoint, fDeletionSet);
116 }
117
118 if (hasLower || !fDeletionSet.empty() || !fInsertionSet.empty()) {
119
120
121 handler->handleInsertionsAndCheckForNewCrossings(eventPoint, fInsertionSet, this);
122 }
123}
Visitor(Ts...) -> Visitor< Ts... >