| 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 DCHECK(capability_checker); | |
| 16 } | |
| 17 | |
| 18 OverlayStrategyAllOrNothing::~OverlayStrategyAllOrNothing() {} | |
| 19 | |
| 20 bool OverlayStrategyAllOrNothing::Attempt(ResourceProvider* resource_provider, | |
| 21 RenderPassList* render_passes, | |
| 22 OverlayCandidateList* candidates, | |
| 23 gfx::Rect* damage_rect) { | |
| 24 QuadList& quad_list = render_passes->back()->quad_list; | |
| 25 OverlayCandidateList new_candidates; | |
| 26 int next_z_order = -1; | |
| 27 | |
| 28 for (const DrawQuad* quad : quad_list) { | |
| 29 OverlayCandidate candidate; | |
| 30 if (!OverlayCandidate::FromDrawQuad(resource_provider, quad, &candidate)) | |
| 31 return false; | |
| 32 candidate.plane_z_order = next_z_order--; | |
| 33 new_candidates.push_back(candidate); | |
| 34 } | |
| 35 | |
| 36 capability_checker_->CheckOverlaySupport(&new_candidates); | |
| 37 for (const OverlayCandidate& candidate : new_candidates) { | |
| 38 if (!candidate.overlay_handled) | |
| 39 return false; | |
| 40 } | |
| 41 | |
| 42 quad_list.clear(); | |
| 43 candidates->swap(new_candidates); | |
| 44 return true; | |
| 45 } | |
| 46 | |
| 47 } // namespace cc | |
| OLD | NEW |