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

Unified Diff: cc/output/overlay_strategy_single_on_top.cc

Issue 1304053016: Mac Overlays: Allow multiple overlays with sandwich strategy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snapshot
Patch Set: Rebase 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
« no previous file with comments | « cc/output/overlay_strategy_single_on_top.h ('k') | cc/output/overlay_strategy_underlay.h » ('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 4908eca919852193a63a9b45d830637f93ef7d10..6b63045c0154c0218baa9bd5704ff52d4db0ddca 100644
--- a/cc/output/overlay_strategy_single_on_top.cc
+++ b/cc/output/overlay_strategy_single_on_top.cc
@@ -14,51 +14,42 @@ namespace cc {
OverlayStrategySingleOnTop::~OverlayStrategySingleOnTop() {}
-bool OverlayStrategySingleOnTop::TryOverlay(
+OverlayResult OverlayStrategySingleOnTop::TryOverlay(
OverlayCandidateValidator* capability_checker,
RenderPassList* render_passes_in_draw_order,
OverlayCandidateList* candidate_list,
const OverlayCandidate& candidate,
- QuadList::Iterator candidate_iterator,
+ QuadList::Iterator* candidate_iterator,
float device_scale_factor) {
RenderPass* root_render_pass = render_passes_in_draw_order->back();
QuadList& quad_list = root_render_pass->quad_list;
- const DrawQuad* draw_quad = *candidate_iterator;
- gfx::RectF rect = MathUtil::MapClippedRect(
- draw_quad->shared_quad_state->quad_to_target_transform,
- gfx::RectF(draw_quad->rect));
-
// Check that no prior quads overlap it.
for (auto overlap_iter = quad_list.cbegin();
- overlap_iter != candidate_iterator; ++overlap_iter) {
+ overlap_iter != *candidate_iterator; ++overlap_iter) {
gfx::RectF overlap_rect = MathUtil::MapClippedRect(
overlap_iter->shared_quad_state->quad_to_target_transform,
gfx::RectF(overlap_iter->rect));
- if (rect.Intersects(overlap_rect) &&
+ if (candidate.display_rect.Intersects(overlap_rect) &&
!OverlayStrategyCommon::IsInvisibleQuad(*overlap_iter))
- return false;
+ return DID_NOT_CREATE_OVERLAY;
}
- // Add our primary surface.
- OverlayCandidateList candidates;
- OverlayCandidate main_image;
- main_image.display_rect = gfx::RectF(root_render_pass->output_rect);
- candidates.push_back(main_image);
-
// Add the overlay.
- candidates.push_back(candidate);
- candidates.back().plane_z_order = 1;
+ OverlayCandidateList new_candidate_list = *candidate_list;
+ new_candidate_list.push_back(candidate);
+ new_candidate_list.back().plane_z_order = 1;
// Check for support.
- capability_checker->CheckOverlaySupport(&candidates);
+ capability_checker->CheckOverlaySupport(&new_candidate_list);
// If the candidate can be handled by an overlay, create a pass for it.
- if (candidates[1].overlay_handled) {
- quad_list.EraseAndInvalidateAllPointers(candidate_iterator);
- candidate_list->swap(candidates);
- return true;
+ if (new_candidate_list.back().overlay_handled) {
+ quad_list.EraseAndInvalidateAllPointers(*candidate_iterator);
+ candidate_list->swap(new_candidate_list);
+ return CREATED_OVERLAY_STOP_LOOKING;
}
- return false;
+
+ return DID_NOT_CREATE_OVERLAY;
}
} // namespace cc
« no previous file with comments | « cc/output/overlay_strategy_single_on_top.h ('k') | cc/output/overlay_strategy_underlay.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698