Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1284)

Unified Diff: cc/output/overlay_strategy_single_on_top.cc

Issue 2746393005: cc: Pick the biggest Quad when selecting an overlay. (Closed)
Patch Set: Early out if we can't find a candidate. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/output/overlay_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/overlay_strategy_single_on_top.cc
diff --git a/cc/output/overlay_strategy_single_on_top.cc b/cc/output/overlay_strategy_single_on_top.cc
index 8ce4c6a38abcf6eaf51b8b3d2316338f7d80abff..f55a4350d6a327c053669b89ab78ce97401dc0ed 100644
--- a/cc/output/overlay_strategy_single_on_top.cc
+++ b/cc/output/overlay_strategy_single_on_top.cc
@@ -25,13 +25,27 @@ bool OverlayStrategySingleOnTop::Attempt(
OverlayCandidateList* candidate_list,
std::vector<gfx::Rect>* content_bounds) {
QuadList* quad_list = &render_pass->quad_list;
+ // Build a list of candidates with the associated quad.
+ OverlayCandidate best_candidate;
+ QuadList::Iterator best_quad_it = quad_list->end();
for (auto it = quad_list->begin(); it != quad_list->end(); ++it) {
OverlayCandidate candidate;
if (OverlayCandidate::FromDrawQuad(resource_provider, *it, &candidate) &&
- TryOverlay(quad_list, candidate_list, candidate, it)) {
- return true;
+ // TODO(dcastagna): Remove this once drm platform supports transforms.
+ candidate.transform == gfx::OVERLAY_TRANSFORM_NONE &&
+ !OverlayCandidate::IsOccluded(candidate, quad_list->cbegin(), it)) {
+ if (candidate.display_rect.size().GetArea() >
+ best_candidate.display_rect.size().GetArea()) {
+ best_candidate = candidate;
+ best_quad_it = it;
+ }
}
}
+ if (best_quad_it == quad_list->end())
+ return false;
+
+ if (TryOverlay(quad_list, candidate_list, best_candidate, best_quad_it))
+ return true;
return false;
}
@@ -41,15 +55,6 @@ bool OverlayStrategySingleOnTop::TryOverlay(
OverlayCandidateList* candidate_list,
const OverlayCandidate& candidate,
QuadList::Iterator candidate_iterator) {
- // Reject transformed overlays.
- // TODO(dcastagna): Remove this once drm platform supports transforms.
- if (candidate.transform != gfx::OVERLAY_TRANSFORM_NONE)
- return false;
- // Check that no prior quads overlap it.
- if (OverlayCandidate::IsOccluded(candidate, quad_list->cbegin(),
- candidate_iterator))
- return false;
-
// Add the overlay.
OverlayCandidateList new_candidate_list = *candidate_list;
new_candidate_list.push_back(candidate);
« no previous file with comments | « no previous file | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698