| 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 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "cc/output/overlay_strategy_fullscreen.h" |
| 12 #include "cc/output/overlay_strategy_single_on_top.h" | 13 #include "cc/output/overlay_strategy_single_on_top.h" |
| 13 #include "cc/output/overlay_strategy_underlay.h" | 14 #include "cc/output/overlay_strategy_underlay.h" |
| 14 #include "ui/ozone/public/overlay_candidates_ozone.h" | 15 #include "ui/ozone/public/overlay_candidates_ozone.h" |
| 15 | 16 |
| 16 namespace display_compositor { | 17 namespace display_compositor { |
| 17 | 18 |
| 18 static gfx::BufferFormat GetBufferFormat(cc::ResourceFormat overlay_format) { | 19 static gfx::BufferFormat GetBufferFormat(cc::ResourceFormat overlay_format) { |
| 19 switch (overlay_format) { | 20 switch (overlay_format) { |
| 20 // TODO(dshwang): overlay video still uses RGBA_8888. | 21 // TODO(dshwang): overlay video still uses RGBA_8888. |
| 21 case cc::RGBA_8888: | 22 case cc::RGBA_8888: |
| 22 case cc::BGRA_8888: | 23 case cc::BGRA_8888: |
| 23 return gfx::BufferFormat::BGRA_8888; | 24 return gfx::BufferFormat::BGRA_8888; |
| 24 default: | 25 default: |
| 25 NOTREACHED(); | 26 NOTREACHED(); |
| 26 return gfx::BufferFormat::BGRA_8888; | 27 return gfx::BufferFormat::BGRA_8888; |
| 27 } | 28 } |
| 28 } | 29 } |
| 29 | 30 |
| 30 CompositorOverlayCandidateValidatorOzone:: | 31 CompositorOverlayCandidateValidatorOzone:: |
| 31 CompositorOverlayCandidateValidatorOzone( | 32 CompositorOverlayCandidateValidatorOzone( |
| 32 std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates) | 33 std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates, |
| 34 bool single_fullscreen) |
| 33 : overlay_candidates_(std::move(overlay_candidates)), | 35 : overlay_candidates_(std::move(overlay_candidates)), |
| 36 single_fullscreen_(single_fullscreen), |
| 34 software_mirror_active_(false) {} | 37 software_mirror_active_(false) {} |
| 35 | 38 |
| 36 CompositorOverlayCandidateValidatorOzone:: | 39 CompositorOverlayCandidateValidatorOzone:: |
| 37 ~CompositorOverlayCandidateValidatorOzone() {} | 40 ~CompositorOverlayCandidateValidatorOzone() {} |
| 38 | 41 |
| 39 void CompositorOverlayCandidateValidatorOzone::GetStrategies( | 42 void CompositorOverlayCandidateValidatorOzone::GetStrategies( |
| 40 cc::OverlayProcessor::StrategyList* strategies) { | 43 cc::OverlayProcessor::StrategyList* strategies) { |
| 41 strategies->push_back( | 44 if (single_fullscreen_) { |
| 42 base::WrapUnique(new cc::OverlayStrategySingleOnTop(this))); | 45 strategies->push_back( |
| 43 strategies->push_back( | 46 base::WrapUnique(new cc::OverlayStrategyFullscreen())); |
| 44 base::WrapUnique(new cc::OverlayStrategyUnderlay(this))); | 47 } else { |
| 48 strategies->push_back( |
| 49 base::WrapUnique(new cc::OverlayStrategySingleOnTop(this))); |
| 50 strategies->push_back( |
| 51 base::WrapUnique(new cc::OverlayStrategyUnderlay(this))); |
| 52 } |
| 45 } | 53 } |
| 46 | 54 |
| 47 bool CompositorOverlayCandidateValidatorOzone::AllowCALayerOverlays() { | 55 bool CompositorOverlayCandidateValidatorOzone::AllowCALayerOverlays() { |
| 48 return false; | 56 return false; |
| 49 } | 57 } |
| 50 | 58 |
| 51 void CompositorOverlayCandidateValidatorOzone::CheckOverlaySupport( | 59 void CompositorOverlayCandidateValidatorOzone::CheckOverlaySupport( |
| 52 cc::OverlayCandidateList* surfaces) { | 60 cc::OverlayCandidateList* surfaces) { |
| 53 // SW mirroring copies out of the framebuffer, so we can't remove any | 61 // SW mirroring copies out of the framebuffer, so we can't remove any |
| 54 // quads for overlaying, otherwise the output is incorrect. | 62 // quads for overlaying, otherwise the output is incorrect. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 81 surfaces->at(i).display_rect = ozone_surface_list.at(i).display_rect; | 89 surfaces->at(i).display_rect = ozone_surface_list.at(i).display_rect; |
| 82 } | 90 } |
| 83 } | 91 } |
| 84 | 92 |
| 85 void CompositorOverlayCandidateValidatorOzone::SetSoftwareMirrorMode( | 93 void CompositorOverlayCandidateValidatorOzone::SetSoftwareMirrorMode( |
| 86 bool enabled) { | 94 bool enabled) { |
| 87 software_mirror_active_ = enabled; | 95 software_mirror_active_ = enabled; |
| 88 } | 96 } |
| 89 | 97 |
| 90 } // namespace display_compositor | 98 } // namespace display_compositor |
| OLD | NEW |