Chromium Code Reviews| Index: ui/ozone/platform/drm/host/drm_overlay_manager.cc |
| diff --git a/ui/ozone/platform/drm/host/drm_overlay_manager.cc b/ui/ozone/platform/drm/host/drm_overlay_manager.cc |
| index 747c43845d31ab0083102f67de5e0bc0f2f53cbe..bab436b61cbaa1e4c91a40c909546a13ecae1b65 100644 |
| --- a/ui/ozone/platform/drm/host/drm_overlay_manager.cc |
| +++ b/ui/ozone/platform/drm/host/drm_overlay_manager.cc |
| @@ -6,62 +6,19 @@ |
| #include "base/command_line.h" |
| #include "ui/gfx/geometry/rect_conversions.h" |
| +#include "ui/ozone/platform/drm/host/drm_host_overlay_candidates.h" |
| #include "ui/ozone/public/overlay_candidates_ozone.h" |
| #include "ui/ozone/public/ozone_switches.h" |
| namespace ui { |
| -namespace { |
| -class SingleOverlay : public OverlayCandidatesOzone { |
| - public: |
| - SingleOverlay() {} |
| - ~SingleOverlay() override {} |
| - |
| - void CheckOverlaySupport(OverlaySurfaceCandidateList* candidates) override { |
| - if (candidates->size() == 2) { |
| - OverlayCandidatesOzone::OverlaySurfaceCandidate* first = |
| - &(*candidates)[0]; |
| - OverlayCandidatesOzone::OverlaySurfaceCandidate* second = |
| - &(*candidates)[1]; |
| - OverlayCandidatesOzone::OverlaySurfaceCandidate* overlay; |
| - if (first->plane_z_order == 0) { |
| - overlay = second; |
| - } else if (second->plane_z_order == 0) { |
| - overlay = first; |
| - } else { |
| - NOTREACHED(); |
| - return; |
| - } |
| - // 0.01 constant chosen to match DCHECKs in gfx::ToNearestRect and avoid |
| - // that code asserting on quads that we accept. |
| - if (overlay->plane_z_order > 0 && |
| - IsTransformSupported(overlay->transform) && |
| - gfx::IsNearestRectWithinDistance(overlay->display_rect, 0.01f)) { |
| - overlay->overlay_handled = true; |
| - } |
| - } |
| - } |
| - |
| - private: |
| - bool IsTransformSupported(gfx::OverlayTransform transform) { |
| - switch (transform) { |
| - case gfx::OVERLAY_TRANSFORM_NONE: |
| - return true; |
| - default: |
| - return false; |
| - } |
| - } |
| - |
| - DISALLOW_COPY_AND_ASSIGN(SingleOverlay); |
| -}; |
| - |
| -} // namespace |
| - |
| -DrmOverlayManager::DrmOverlayManager(bool allow_surfaceless) |
| - : allow_surfaceless_(allow_surfaceless) { |
| - if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kOzoneTestSingleOverlaySupport)) |
| - candidates_ = make_scoped_ptr(new SingleOverlay()); |
| +DrmOverlayManager::DrmOverlayManager( |
| + bool allow_surfaceless, |
| + DrmGpuPlatformSupportHost* platform_support_host) |
| + : platform_support_host_(platform_support_host), |
| + allow_surfaceless_(allow_surfaceless) { |
| + is_supported_ = base::CommandLine::ForCurrentProcess()->HasSwitch( |
|
dnicoara
2015/05/28 21:09:54
This is never used.
achaulk
2015/05/29 18:49:21
Oh, yeah this should gate object creation
|
| + switches::kOzoneTestSingleOverlaySupport); |
| } |
| DrmOverlayManager::~DrmOverlayManager() { |
| @@ -69,7 +26,7 @@ DrmOverlayManager::~DrmOverlayManager() { |
| OverlayCandidatesOzone* DrmOverlayManager::GetOverlayCandidates( |
| gfx::AcceleratedWidget w) { |
| - return candidates_.get(); |
| + return new DrmHostOverlayCandidates(w, platform_support_host_); |
|
dnicoara
2015/05/28 21:09:54
This is leaking the DrmHostOverlayCandidates.
achaulk
2015/05/29 18:49:21
Yeah I was still deciding where it should be destr
|
| } |
| bool DrmOverlayManager::CanShowPrimaryPlaneAsOverlay() { |