Chromium Code Reviews| 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 6b63045c0154c0218baa9bd5704ff52d4db0ddca..d08da5cd31452a8409f9f2d9f5ced28717ce25f9 100644 |
| --- a/cc/output/overlay_strategy_single_on_top.cc |
| +++ b/cc/output/overlay_strategy_single_on_top.cc |
| @@ -4,34 +4,48 @@ |
| #include "cc/output/overlay_strategy_single_on_top.h" |
| -#include <limits> |
| - |
| #include "cc/base/math_util.h" |
| #include "cc/output/overlay_candidate_validator.h" |
| #include "cc/quads/draw_quad.h" |
| namespace cc { |
| +OverlayStrategySingleOnTop::OverlayStrategySingleOnTop( |
| + OverlayCandidateValidator* capability_checker) |
| + : capability_checker_(capability_checker) { |
| + DCHECK(capability_checker); |
| +} |
| + |
| OverlayStrategySingleOnTop::~OverlayStrategySingleOnTop() {} |
| -OverlayResult OverlayStrategySingleOnTop::TryOverlay( |
| - OverlayCandidateValidator* capability_checker, |
| - RenderPassList* render_passes_in_draw_order, |
| +bool OverlayStrategySingleOnTop::Attempt(RenderPassList* render_passes, |
| + OverlayCandidateList* candidate_list) { |
| + QuadList& quad_list = render_passes->back()->quad_list; |
|
ccameron
2015/10/05 19:28:29
Just out of curiosity, any reason you didn't inlin
Andre
2015/10/05 20:24:20
To inline, the "return false" in line 48 needs to
|
| + for (auto it = quad_list.begin(); it != quad_list.end(); ++it) { |
| + OverlayCandidate candidate; |
| + if (OverlayCandidate::FromDrawQuad(*it, &candidate) && |
| + TryOverlay(quad_list, candidate_list, candidate, it)) { |
| + return true; |
| + } |
| + } |
| + |
| + return false; |
| +} |
| + |
| +bool OverlayStrategySingleOnTop::TryOverlay( |
| + QuadList& quad_list, |
| OverlayCandidateList* candidate_list, |
| const OverlayCandidate& candidate, |
| - 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; |
| + QuadList::Iterator candidate_iterator) { |
| // 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 (candidate.display_rect.Intersects(overlap_rect) && |
| - !OverlayStrategyCommon::IsInvisibleQuad(*overlap_iter)) |
| - return DID_NOT_CREATE_OVERLAY; |
| + !OverlayCandidate::IsInvisibleQuad(*overlap_iter)) |
| + return false; |
| } |
| // Add the overlay. |
| @@ -40,16 +54,16 @@ OverlayResult OverlayStrategySingleOnTop::TryOverlay( |
| new_candidate_list.back().plane_z_order = 1; |
| // Check for support. |
| - capability_checker->CheckOverlaySupport(&new_candidate_list); |
| + capability_checker_->CheckOverlaySupport(&new_candidate_list); |
| // If the candidate can be handled by an overlay, create a pass for it. |
| if (new_candidate_list.back().overlay_handled) { |
| - quad_list.EraseAndInvalidateAllPointers(*candidate_iterator); |
| + quad_list.EraseAndInvalidateAllPointers(candidate_iterator); |
| candidate_list->swap(new_candidate_list); |
| - return CREATED_OVERLAY_STOP_LOOKING; |
| + return true; |
| } |
| - return DID_NOT_CREATE_OVERLAY; |
| + return false; |
| } |
| } // namespace cc |