34 Private::IteratorRange range;
35 range =
m_d->findFirstIntersectingInterval(*interval);
37 Private::LineIntervalMap::iterator it = range.beginIt;
39 while (interval->
isValid() && it != range.endIt) {
40 bool needsIncrement =
true;
42 if (it->start <= interval->
start && it->end >= interval->
start) {
43 int savedIntervalStart = interval->
start;
44 interval->
start = it->end + 1;
50 if (it->end > interval->
end) {
52 range.rowMapIt->insert(newInterval.
start, newInterval);
55 it->end = savedIntervalStart - 1;
65 it = range.rowMapIt->erase(it);
66 needsIncrement =
false;
68 }
else if (it->start <= interval->
end && it->end >= interval->
end) {
69 int savedIntervalEnd = interval->
end;
70 interval->
end = it->start - 1;
71 it->start = savedIntervalEnd + 1;
78 it = range.rowMapIt->erase(it);
79 needsIncrement =
false;
81 }
else if (it->start > interval->
end) {
85#ifdef ENABLE_FILL_SANITY_CHECKS
86 else if (it->start > interval->
start && it->end < interval->
end) {
87 SANITY_ASSERT_MSG(0,
"FATAL: The backward interval cannot fully reside inside the forward interval");
90 it = range.rowMapIt->erase(it);
91 needsIncrement =
false;
97 "FATAL: The backward interval cannot become "
98 "invalid during the crop action") {
99 it = range.rowMapIt->erase(it);
100 needsIncrement =
false;
104 if (needsIncrement) {
139 Private::GlobalMap::const_iterator rowMapIt =
m_d->map.constBegin();
140 Private::GlobalMap::const_iterator rowMapEndIt =
m_d->map.constEnd();
142 while (rowMapIt != rowMapEndIt) {
143 Private::LineIntervalMap::const_iterator it = rowMapIt->constBegin();
144 Private::LineIntervalMap::const_iterator end = rowMapIt->constEnd();
148 interval.
row += rowCorrection;
149 intervals.append(interval);