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