| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_single_on_top.h" | 5 #include "cc/output/overlay_strategy_single_on_top.h" |
| 6 | 6 |
| 7 #include "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
| 8 #include "cc/output/overlay_candidate_validator.h" | 8 #include "cc/output/overlay_candidate_validator.h" |
| 9 #include "cc/quads/draw_quad.h" | 9 #include "cc/quads/draw_quad.h" |
| 10 #include "ui/gfx/geometry/rect_conversions.h" | 10 #include "ui/gfx/geometry/rect_conversions.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 return false; | 34 return false; |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool OverlayStrategySingleOnTop::TryOverlay( | 37 bool OverlayStrategySingleOnTop::TryOverlay( |
| 38 QuadList* quad_list, | 38 QuadList* quad_list, |
| 39 OverlayCandidateList* candidate_list, | 39 OverlayCandidateList* candidate_list, |
| 40 const OverlayCandidate& candidate, | 40 const OverlayCandidate& candidate, |
| 41 QuadList::Iterator candidate_iterator) { | 41 QuadList::Iterator candidate_iterator) { |
| 42 // Reject transformed overlays. |
| 43 // TODO(dcastagna): Remove this once drm platform supports transforms. |
| 44 if (candidate.transform != gfx::OVERLAY_TRANSFORM_NONE) |
| 45 return false; |
| 42 // Check that no prior quads overlap it. | 46 // Check that no prior quads overlap it. |
| 43 if (OverlayCandidate::IsOccluded(candidate, quad_list->cbegin(), | 47 if (OverlayCandidate::IsOccluded(candidate, quad_list->cbegin(), |
| 44 candidate_iterator)) | 48 candidate_iterator)) |
| 45 return false; | 49 return false; |
| 46 | 50 |
| 47 // Add the overlay. | 51 // Add the overlay. |
| 48 OverlayCandidateList new_candidate_list = *candidate_list; | 52 OverlayCandidateList new_candidate_list = *candidate_list; |
| 49 new_candidate_list.push_back(candidate); | 53 new_candidate_list.push_back(candidate); |
| 50 new_candidate_list.back().plane_z_order = 1; | 54 new_candidate_list.back().plane_z_order = 1; |
| 51 | 55 |
| 52 // Check for support. | 56 // Check for support. |
| 53 capability_checker_->CheckOverlaySupport(&new_candidate_list); | 57 capability_checker_->CheckOverlaySupport(&new_candidate_list); |
| 54 | 58 |
| 55 const OverlayCandidate& overlay_candidate = new_candidate_list.back(); | 59 const OverlayCandidate& overlay_candidate = new_candidate_list.back(); |
| 56 // If the candidate can be handled by an overlay, create a pass for it. | 60 // If the candidate can be handled by an overlay, create a pass for it. |
| 57 if (overlay_candidate.overlay_handled) { | 61 if (overlay_candidate.overlay_handled) { |
| 58 quad_list->EraseAndInvalidateAllPointers(candidate_iterator); | 62 quad_list->EraseAndInvalidateAllPointers(candidate_iterator); |
| 59 candidate_list->swap(new_candidate_list); | 63 candidate_list->swap(new_candidate_list); |
| 60 return true; | 64 return true; |
| 61 } | 65 } |
| 62 | 66 |
| 63 return false; | 67 return false; |
| 64 } | 68 } |
| 65 | 69 |
| 66 } // namespace cc | 70 } // namespace cc |
| OLD | NEW |