| 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 "components/display_compositor/compositor_overlay_candidate_validator_o
zone.h" | 5 #include "components/display_compositor/compositor_overlay_candidate_validator_o
zone.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 : overlay_candidates_(std::move(overlay_candidates)), | 35 : overlay_candidates_(std::move(overlay_candidates)), |
| 36 single_fullscreen_(single_fullscreen), | 36 single_fullscreen_(single_fullscreen), |
| 37 software_mirror_active_(false) {} | 37 software_mirror_active_(false) {} |
| 38 | 38 |
| 39 CompositorOverlayCandidateValidatorOzone:: | 39 CompositorOverlayCandidateValidatorOzone:: |
| 40 ~CompositorOverlayCandidateValidatorOzone() {} | 40 ~CompositorOverlayCandidateValidatorOzone() {} |
| 41 | 41 |
| 42 void CompositorOverlayCandidateValidatorOzone::GetStrategies( | 42 void CompositorOverlayCandidateValidatorOzone::GetStrategies( |
| 43 cc::OverlayProcessor::StrategyList* strategies) { | 43 cc::OverlayProcessor::StrategyList* strategies) { |
| 44 if (single_fullscreen_) { | 44 if (single_fullscreen_) { |
| 45 strategies->push_back(base::MakeUnique<cc::OverlayStrategyFullscreen>()); | 45 strategies->push_back( |
| 46 base::MakeUnique<cc::OverlayStrategyFullscreen>(this)); |
| 46 } else { | 47 } else { |
| 47 strategies->push_back( | 48 strategies->push_back( |
| 48 base::MakeUnique<cc::OverlayStrategySingleOnTop>(this)); | 49 base::MakeUnique<cc::OverlayStrategySingleOnTop>(this)); |
| 49 strategies->push_back(base::MakeUnique<cc::OverlayStrategyUnderlay>(this)); | 50 strategies->push_back(base::MakeUnique<cc::OverlayStrategyUnderlay>(this)); |
| 50 } | 51 } |
| 51 } | 52 } |
| 52 | 53 |
| 53 bool CompositorOverlayCandidateValidatorOzone::AllowCALayerOverlays() { | 54 bool CompositorOverlayCandidateValidatorOzone::AllowCALayerOverlays() { |
| 54 return false; | 55 return false; |
| 55 } | 56 } |
| 56 | 57 |
| 57 void CompositorOverlayCandidateValidatorOzone::CheckOverlaySupport( | 58 void CompositorOverlayCandidateValidatorOzone::CheckOverlaySupport( |
| 58 cc::OverlayCandidateList* surfaces) { | 59 cc::OverlayCandidateList* surfaces) { |
| 59 // SW mirroring copies out of the framebuffer, so we can't remove any | 60 // SW mirroring copies out of the framebuffer, so we can't remove any |
| 60 // quads for overlaying, otherwise the output is incorrect. | 61 // quads for overlaying, otherwise the output is incorrect. |
| 61 if (software_mirror_active_) | 62 if (software_mirror_active_) { |
| 63 for (size_t i = 0; i < surfaces->size(); i++) { |
| 64 surfaces->at(i).overlay_handled = false; |
| 65 } |
| 62 return; | 66 return; |
| 67 } |
| 68 |
| 69 if (single_fullscreen_) { |
| 70 return; // No need for validation for single fullscreen. |
| 71 } |
| 63 | 72 |
| 64 DCHECK_GE(2U, surfaces->size()); | 73 DCHECK_GE(2U, surfaces->size()); |
| 65 ui::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list; | 74 ui::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list; |
| 66 ozone_surface_list.resize(surfaces->size()); | 75 ozone_surface_list.resize(surfaces->size()); |
| 67 | 76 |
| 68 for (size_t i = 0; i < surfaces->size(); i++) { | 77 for (size_t i = 0; i < surfaces->size(); i++) { |
| 69 ozone_surface_list.at(i).transform = surfaces->at(i).transform; | 78 ozone_surface_list.at(i).transform = surfaces->at(i).transform; |
| 70 ozone_surface_list.at(i).format = GetBufferFormat(surfaces->at(i).format); | 79 ozone_surface_list.at(i).format = GetBufferFormat(surfaces->at(i).format); |
| 71 ozone_surface_list.at(i).display_rect = surfaces->at(i).display_rect; | 80 ozone_surface_list.at(i).display_rect = surfaces->at(i).display_rect; |
| 72 ozone_surface_list.at(i).crop_rect = surfaces->at(i).uv_rect; | 81 ozone_surface_list.at(i).crop_rect = surfaces->at(i).uv_rect; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 87 surfaces->at(i).display_rect = ozone_surface_list.at(i).display_rect; | 96 surfaces->at(i).display_rect = ozone_surface_list.at(i).display_rect; |
| 88 } | 97 } |
| 89 } | 98 } |
| 90 | 99 |
| 91 void CompositorOverlayCandidateValidatorOzone::SetSoftwareMirrorMode( | 100 void CompositorOverlayCandidateValidatorOzone::SetSoftwareMirrorMode( |
| 92 bool enabled) { | 101 bool enabled) { |
| 93 software_mirror_active_ = enabled; | 102 software_mirror_active_ = enabled; |
| 94 } | 103 } |
| 95 | 104 |
| 96 } // namespace display_compositor | 105 } // namespace display_compositor |
| OLD | NEW |