Skip to content

Commit

Permalink
Skip rectangles from current span line when debanding
Browse files Browse the repository at this point in the history
  • Loading branch information
knopp committed May 30, 2023
1 parent a1fd733 commit 81e3805
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions display_list/geometry/dl_region.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,19 @@ void DlRegion::addRect(const SkIRect& rect) {

std::vector<SkIRect> DlRegion::getRects(bool deband) const {
std::vector<SkIRect> rects;
size_t previous_span_end = 0;
for (const auto& line : lines_) {
for (const Span& span : *line.spans) {
SkIRect rect{span.left, line.top, span.right, line.bottom};
if (deband) {
auto iter = rects.end();
// If there is recangle previously in rects on which this one is a
auto iter = rects.begin() + previous_span_end;
// If there is rectangle previously in rects on which this one is a
// vertical continuation, remove the previous rectangle and expand this
// one vertically to cover the area.
while (iter != rects.begin()) {
--iter;
if (iter->bottom() < rect.top()) {
// Went too far.
// Went all the way to previous span line.
break;
} else if (iter->bottom() == rect.top() &&
iter->left() == rect.left() &&
Expand All @@ -214,6 +215,7 @@ std::vector<SkIRect> DlRegion::getRects(bool deband) const {
}
rects.push_back(rect);
}
previous_span_end = rects.size();
}
return rects;
}
Expand Down

0 comments on commit 81e3805

Please sign in to comment.