This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -190,18 +190,19 @@ void DlRegion::addRect(const SkIRect& rect) {
190
190
191
191
std::vector<SkIRect> DlRegion::getRects (bool deband) const {
192
192
std::vector<SkIRect> rects;
193
+ size_t previous_span_end = 0 ;
193
194
for (const auto & line : lines_) {
194
195
for (const Span& span : *line.spans ) {
195
196
SkIRect rect{span.left , line.top , span.right , line.bottom };
196
197
if (deband) {
197
- auto iter = rects.end () ;
198
- // If there is recangle previously in rects on which this one is a
198
+ auto iter = rects.begin () + previous_span_end ;
199
+ // If there is rectangle previously in rects on which this one is a
199
200
// vertical continuation, remove the previous rectangle and expand this
200
201
// one vertically to cover the area.
201
202
while (iter != rects.begin ()) {
202
203
--iter;
203
204
if (iter->bottom () < rect.top ()) {
204
- // Went too far .
205
+ // Went all the way to previous span line .
205
206
break ;
206
207
} else if (iter->bottom () == rect.top () &&
207
208
iter->left () == rect.left () &&
@@ -214,6 +215,7 @@ std::vector<SkIRect> DlRegion::getRects(bool deband) const {
214
215
}
215
216
rects.push_back (rect);
216
217
}
218
+ previous_span_end = rects.size ();
217
219
}
218
220
return rects;
219
221
}
You can’t perform that action at this time.
0 commit comments