diff options
author | halliwell <halliwell@chromium.org> | 2015-04-14 14:15:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-14 21:16:25 +0000 |
commit | f9ed5e4c06176226d31216dd995b9a45f411d831 (patch) | |
tree | 1506dda28ca8fc891d27a35704e565d51cb6b377 /ui/ozone/platform/cast/surface_factory_cast.cc | |
parent | c3cfb9cac0470cc09c369e58c7623b45cb7004e0 (diff) | |
download | chromium_src-f9ed5e4c06176226d31216dd995b9a45f411d831.zip chromium_src-f9ed5e4c06176226d31216dd995b9a45f411d831.tar.gz chromium_src-f9ed5e4c06176226d31216dd995b9a45f411d831.tar.bz2 |
Adds new chromecast/public API for display resolution queries
This is to replace the old static "Is1080pAllowed" API.
BUG=
Review URL: https://codereview.chromium.org/1080833002
Cr-Commit-Position: refs/heads/master@{#325122}
Diffstat (limited to 'ui/ozone/platform/cast/surface_factory_cast.cc')
-rw-r--r-- | ui/ozone/platform/cast/surface_factory_cast.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ui/ozone/platform/cast/surface_factory_cast.cc b/ui/ozone/platform/cast/surface_factory_cast.cc index aaab109..3acb22c 100644 --- a/ui/ozone/platform/cast/surface_factory_cast.cc +++ b/ui/ozone/platform/cast/surface_factory_cast.cc @@ -15,19 +15,21 @@ namespace { CastEglPlatform::Size FromGfxSize(const gfx::Size& size) { return CastEglPlatform::Size(size.width(), size.height()); } -gfx::Size ToGfxSize(const CastEglPlatform::Size& size) { - return gfx::Size(size.width, size.height); -} + +// Hard lower bound on display resolution +gfx::Size GetMinDisplaySize() { + return gfx::Size(1280, 720); } +} // namespace + SurfaceFactoryCast::SurfaceFactoryCast(scoped_ptr<CastEglPlatform> egl_platform) : state_(kUninitialized), destroy_window_pending_state_(kNoDestroyPending), display_type_(0), window_(0), - default_display_size_(ToGfxSize(egl_platform->GetDefaultDisplaySize())), - display_size_(default_display_size_), - new_display_size_(default_display_size_), + display_size_(0, 0), + new_display_size_(0, 0), egl_platform_(egl_platform.Pass()) { } @@ -97,7 +99,7 @@ intptr_t SurfaceFactoryCast::GetNativeWindow() { bool SurfaceFactoryCast::ResizeDisplay(gfx::Size size) { // set size to at least 1280x720 even if passed 1x1 - size.SetToMax(default_display_size_); + size.SetToMax(GetMinDisplaySize()); if (display_type_ && size != display_size_) { DestroyDisplayTypeAndWindow(); } @@ -119,7 +121,7 @@ void SurfaceFactoryCast::DestroyDisplayTypeAndWindow() { scoped_ptr<SurfaceOzoneEGL> SurfaceFactoryCast::CreateEGLSurfaceForWidget( gfx::AcceleratedWidget widget) { new_display_size_ = gfx::Size(widget >> 16, widget & 0xFFFF); - new_display_size_.SetToMax(default_display_size_); + new_display_size_.SetToMax(GetMinDisplaySize()); destroy_window_pending_state_ = kSurfaceExists; SendRelinquishResponse(); return make_scoped_ptr<SurfaceOzoneEGL>(new SurfaceOzoneEglCast(this)); |