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

Unified Diff: cc/output/overlay_strategy_common.cc

Issue 1304053016: Mac Overlays: Allow multiple overlays with sandwich strategy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snapshot
Patch Set: Add tests Created 5 years, 3 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
Index: cc/output/overlay_strategy_common.cc
diff --git a/cc/output/overlay_strategy_common.cc b/cc/output/overlay_strategy_common.cc
index 5d79cd09878555a375dd715f0421b92079738617..896003d4ecbef708460a6676058abb56aac4ae0f 100644
--- a/cc/output/overlay_strategy_common.cc
+++ b/cc/output/overlay_strategy_common.cc
@@ -33,18 +33,38 @@ bool OverlayStrategyCommon::Attempt(RenderPassList* render_passes_in_draw_order,
RenderPass* root_render_pass = render_passes_in_draw_order->back();
DCHECK(root_render_pass);
+ // Add our primary surface.
+ OverlayCandidate main_image;
+ main_image.display_rect = root_render_pass->output_rect;
+ DCHECK(candidate_list->empty());
+ candidate_list->push_back(main_image);
+
+ bool success = false;
QuadList& quad_list = root_render_pass->quad_list;
- for (auto it = quad_list.begin(); it != quad_list.end(); ++it) {
+ for (auto it = quad_list.begin(); it != quad_list.end();) {
OverlayCandidate candidate;
const DrawQuad* draw_quad = *it;
if (IsOverlayQuad(draw_quad) &&
- GetCandidateQuadInfo(*draw_quad, &candidate) &&
- delegate_->TryOverlay(capability_checker_, render_passes_in_draw_order,
- candidate_list, candidate, it,
- device_scale_factor))
- return true;
+ GetCandidateQuadInfo(*draw_quad, &candidate)) {
+ OverlayResult result = delegate_->TryOverlay(
+ capability_checker_, render_passes_in_draw_order, candidate_list,
+ candidate, &it, device_scale_factor);
+ if (result == CREATED_OVERLAY_STOP_LOOKING) {
+ return true;
alexst (slow to review) 2015/09/04 15:32:10 This is a little weird because on this path you do
Andre 2015/09/04 17:22:47 Done.
+ } else if (result == CREATED_OVERLAY_KEEP_LOOKING) {
+ success = true;
+ continue;
+ }
+ }
+ ++it;
}
- return false;
+
+ if (!success) {
+ DCHECK_EQ(1u, candidate_list->size());
+ candidate_list->clear();
+ }
+
+ return success;
}
bool OverlayStrategyCommon::IsOverlayQuad(const DrawQuad* draw_quad) {

Powered by Google App Engine
This is Rietveld 408576698