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 "components/display_compositor/compositor_overlay_candidate_validator_a
ndroid.h" | 5 #include "components/display_compositor/compositor_overlay_candidate_validator_a
ndroid.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "cc/output/overlay_processor.h" | 10 #include "cc/output/overlay_processor.h" |
11 #include "cc/output/overlay_strategy_underlay.h" | 11 #include "cc/output/overlay_strategy_underlay.h" |
12 #include "ui/gfx/geometry/rect_conversions.h" | 12 #include "ui/gfx/geometry/rect_conversions.h" |
13 | 13 |
14 namespace display_compositor { | 14 namespace display_compositor { |
15 | 15 |
16 CompositorOverlayCandidateValidatorAndroid:: | 16 CompositorOverlayCandidateValidatorAndroid:: |
17 CompositorOverlayCandidateValidatorAndroid() {} | 17 CompositorOverlayCandidateValidatorAndroid() {} |
18 | 18 |
19 CompositorOverlayCandidateValidatorAndroid:: | 19 CompositorOverlayCandidateValidatorAndroid:: |
20 ~CompositorOverlayCandidateValidatorAndroid() {} | 20 ~CompositorOverlayCandidateValidatorAndroid() {} |
21 | 21 |
22 void CompositorOverlayCandidateValidatorAndroid::GetStrategies( | 22 void CompositorOverlayCandidateValidatorAndroid::GetStrategies( |
23 cc::OverlayProcessor::StrategyList* strategies) { | 23 cc::OverlayProcessor::StrategyList* strategies) { |
24 strategies->push_back( | 24 strategies->push_back(base::MakeUnique<cc::OverlayStrategyUnderlay>(this)); |
25 base::WrapUnique(new cc::OverlayStrategyUnderlay(this))); | |
26 } | 25 } |
27 | 26 |
28 void CompositorOverlayCandidateValidatorAndroid::CheckOverlaySupport( | 27 void CompositorOverlayCandidateValidatorAndroid::CheckOverlaySupport( |
29 cc::OverlayCandidateList* candidates) { | 28 cc::OverlayCandidateList* candidates) { |
30 // There should only be at most a single overlay candidate: the video quad. | 29 // There should only be at most a single overlay candidate: the video quad. |
31 // There's no check that the presented candidate is really a video frame for | 30 // There's no check that the presented candidate is really a video frame for |
32 // a fullscreen video. Instead it's assumed that if a quad is marked as | 31 // a fullscreen video. Instead it's assumed that if a quad is marked as |
33 // overlayable, it's a fullscreen video quad. | 32 // overlayable, it's a fullscreen video quad. |
34 DCHECK_LE(candidates->size(), 1u); | 33 DCHECK_LE(candidates->size(), 1u); |
35 | 34 |
36 if (!candidates->empty()) { | 35 if (!candidates->empty()) { |
37 cc::OverlayCandidate& candidate = candidates->front(); | 36 cc::OverlayCandidate& candidate = candidates->front(); |
38 candidate.display_rect = | 37 candidate.display_rect = |
39 gfx::RectF(gfx::ToEnclosingRect(candidate.display_rect)); | 38 gfx::RectF(gfx::ToEnclosingRect(candidate.display_rect)); |
40 candidate.overlay_handled = true; | 39 candidate.overlay_handled = true; |
41 candidate.plane_z_order = -1; | 40 candidate.plane_z_order = -1; |
42 } | 41 } |
43 } | 42 } |
44 | 43 |
45 bool CompositorOverlayCandidateValidatorAndroid::AllowCALayerOverlays() { | 44 bool CompositorOverlayCandidateValidatorAndroid::AllowCALayerOverlays() { |
46 return false; | 45 return false; |
47 } | 46 } |
48 | 47 |
49 // Overlays will still be allowed when software mirroring is enabled, even | 48 // Overlays will still be allowed when software mirroring is enabled, even |
50 // though they won't appear in the mirror. | 49 // though they won't appear in the mirror. |
51 void CompositorOverlayCandidateValidatorAndroid::SetSoftwareMirrorMode( | 50 void CompositorOverlayCandidateValidatorAndroid::SetSoftwareMirrorMode( |
52 bool enabled) {} | 51 bool enabled) {} |
53 | 52 |
54 } // namespace display_compositor | 53 } // namespace display_compositor |
OLD | NEW |