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