| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/output/overlay_strategy_all_or_nothing.h" |
| 6 |
| 7 #include "cc/output/overlay_candidate_validator.h" |
| 8 #include "cc/quads/draw_quad.h" |
| 9 |
| 10 namespace cc { |
| 11 |
| 12 OverlayStrategyAllOrNothing::OverlayStrategyAllOrNothing( |
| 13 OverlayCandidateValidator* capability_checker) |
| 14 : capability_checker_(capability_checker) {} |
| 15 |
| 16 OverlayStrategyAllOrNothing::~OverlayStrategyAllOrNothing() {} |
| 17 |
| 18 bool OverlayStrategyAllOrNothing::Attempt(RenderPassList* render_passes, |
| 19 OverlayCandidateList* candidates, |
| 20 float device_scale_factor) { |
| 21 QuadList& quad_list = render_passes->back()->quad_list; |
| 22 OverlayCandidateList new_candidates; |
| 23 int next_z_order = -1; |
| 24 |
| 25 for (const DrawQuad* quad : quad_list) { |
| 26 OverlayCandidate candidate; |
| 27 if (!OverlayCandidate::FromDrawQuad(quad, &candidate)) |
| 28 return false; |
| 29 candidate.plane_z_order = next_z_order--; |
| 30 new_candidates.push_back(candidate); |
| 31 } |
| 32 |
| 33 capability_checker_->CheckOverlaySupport(&new_candidates); |
| 34 for (const OverlayCandidate& candidate : new_candidates) { |
| 35 if (!candidate.overlay_handled) |
| 36 return false; |
| 37 } |
| 38 |
| 39 quad_list.clear(); |
| 40 candidates->swap(new_candidates); |
| 41 return true; |
| 42 } |
| 43 |
| 44 } // namespace cc |
| OLD | NEW |