Chromium Code Reviews| Index: ui/ozone/platform/cast/surface_factory_cast.cc |
| diff --git a/ui/ozone/platform/cast/surface_factory_cast.cc b/ui/ozone/platform/cast/surface_factory_cast.cc |
| index f3dbe1cfd0c8bfef07ab0e86c0a2f746885f4d33..eec09476bf748591d12cab341dc5172a26610543 100644 |
| --- a/ui/ozone/platform/cast/surface_factory_cast.cc |
| +++ b/ui/ozone/platform/cast/surface_factory_cast.cc |
| @@ -10,8 +10,11 @@ |
| #include <utility> |
| #include "base/callback_helpers.h" |
| +#include "base/command_line.h" |
| #include "base/macros.h" |
| #include "base/memory/ptr_util.h" |
| +#include "base/strings/string_number_conversions.h" |
| +#include "chromecast/base/chromecast_switches.h" |
| #include "chromecast/public/cast_egl_platform.h" |
| #include "chromecast/public/graphics_types.h" |
| #include "third_party/skia/include/core/SkSurface.h" |
| @@ -34,13 +37,18 @@ chromecast::Size FromGfxSize(const gfx::Size& size) { |
| return chromecast::Size(size.width(), size.height()); |
| } |
| -// Initial display size to create, needed before first window is created. |
| -gfx::Size GetInitialDisplaySize() { |
| - return gfx::Size(1280, 720); |
| -} |
| - |
| -// Hard lower bound on display resolution |
| -gfx::Size GetMinDisplaySize() { |
| +// Display resolution, set in browser process and passed by switches. |
| +gfx::Size GetDisplaySize() { |
| + base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| + int width, height; |
| + if (base::StringToInt( |
| + cmd_line->GetSwitchValueASCII(switches::kInitialScreenWidth), |
| + &width) && |
| + base::StringToInt( |
| + cmd_line->GetSwitchValueASCII(switches::kInitialScreenHeight), |
| + &height)) { |
| + return gfx::Size(width, height); |
| + } |
| return gfx::Size(1280, 720); |
|
alokp
2016/07/06 16:58:44
LOG(WARNING)?
halliwell
2016/07/07 20:07:14
Done.
|
| } |
| @@ -79,8 +87,7 @@ SurfaceFactoryCast::SurfaceFactoryCast( |
| display_type_(0), |
| have_display_type_(false), |
| window_(0), |
| - display_size_(GetInitialDisplaySize()), |
| - new_display_size_(GetInitialDisplaySize()), |
| + display_size_(GetDisplaySize()), |
| egl_platform_(std::move(egl_platform)), |
| overlay_count_(0), |
| previous_frame_overlay_count_(0) {} |
| @@ -175,10 +182,6 @@ void SurfaceFactoryCast::CreateDisplayTypeAndWindowIfNeeded() { |
| if (state_ == kUninitialized) { |
| InitializeHardware(); |
| } |
| - if (new_display_size_ != display_size_) { |
| - DestroyDisplayTypeAndWindow(); |
| - display_size_ = new_display_size_; |
| - } |
| DCHECK_EQ(state_, kInitialized); |
| if (!have_display_type_) { |
| chromecast::Size create_size = FromGfxSize(display_size_); |
| @@ -203,13 +206,8 @@ intptr_t SurfaceFactoryCast::GetNativeWindow() { |
| } |
| bool SurfaceFactoryCast::ResizeDisplay(gfx::Size size) { |
| - // set size to at least 1280x720 even if passed 1x1 |
| - size.SetToMax(GetMinDisplaySize()); |
| - if (have_display_type_ && size != display_size_) { |
| - DestroyDisplayTypeAndWindow(); |
| - } |
| - display_size_ = size; |
| - return true; |
| + NOTIMPLEMENTED(); |
| + return false; |
| } |
| void SurfaceFactoryCast::DestroyWindow() { |
| @@ -230,8 +228,8 @@ void SurfaceFactoryCast::DestroyDisplayTypeAndWindow() { |
| std::unique_ptr<SurfaceOzoneEGL> SurfaceFactoryCast::CreateEGLSurfaceForWidget( |
| gfx::AcceleratedWidget widget) { |
| - new_display_size_ = gfx::Size(widget >> 16, widget & 0xFFFF); |
| - new_display_size_.SetToMax(GetMinDisplaySize()); |
| + DCHECK_EQ(widget >> 16, display_size_.width()); |
|
alokp
2016/07/06 16:58:44
Add a comment what this DCHECK attempts to verify.
halliwell
2016/07/07 20:07:14
Done.
|
| + DCHECK_EQ(widget & 0xffff, display_size_.height()); |
| return base::WrapUnique<SurfaceOzoneEGL>(new SurfaceOzoneEglCast(this)); |
| } |