Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 81e3805

Browse files
committed
Skip rectangles from current span line when debanding
1 parent a1fd733 commit 81e3805

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

display_list/geometry/dl_region.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,19 @@ void DlRegion::addRect(const SkIRect& rect) {
190190

191191
std::vector<SkIRect> DlRegion::getRects(bool deband) const {
192192
std::vector<SkIRect> rects;
193+
size_t previous_span_end = 0;
193194
for (const auto& line : lines_) {
194195
for (const Span& span : *line.spans) {
195196
SkIRect rect{span.left, line.top, span.right, line.bottom};
196197
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
199200
// vertical continuation, remove the previous rectangle and expand this
200201
// one vertically to cover the area.
201202
while (iter != rects.begin()) {
202203
--iter;
203204
if (iter->bottom() < rect.top()) {
204-
// Went too far.
205+
// Went all the way to previous span line.
205206
break;
206207
} else if (iter->bottom() == rect.top() &&
207208
iter->left() == rect.left() &&
@@ -214,6 +215,7 @@ std::vector<SkIRect> DlRegion::getRects(bool deband) const {
214215
}
215216
rects.push_back(rect);
216217
}
218+
previous_span_end = rects.size();
217219
}
218220
return rects;
219221
}

0 commit comments

Comments
 (0)