Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Unified Diff: services/ui/ws/platform_display.cc

Issue 2190633002: Add flag to launch two displays for mus+ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/platform_display.h ('k') | services/ui/ws/test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/platform_display.cc
diff --git a/services/ui/ws/platform_display.cc b/services/ui/ws/platform_display.cc
index f35de8fbeaa0c7d77ec078a4b1852397bf21c712..ae6d7afcc1fa7be544555fdb18e4ca1a704ebbf7 100644
--- a/services/ui/ws/platform_display.cc
+++ b/services/ui/ws/platform_display.cc
@@ -62,27 +62,26 @@ DefaultPlatformDisplay::DefaultPlatformDisplay(
frame_generator_(new FrameGenerator(this,
init_params.gpu_state,
init_params.surfaces_state)) {
- metrics_.size_in_pixels = init_params.display_bounds.size();
+ metrics_.bounds = init_params.display_bounds;
// TODO(rjkroege): Preserve the display_id when Ozone platform can use it.
}
void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) {
delegate_ = delegate;
- gfx::Rect bounds(metrics_.size_in_pixels);
#if defined(OS_WIN)
- platform_window_.reset(new ui::WinWindow(this, bounds));
+ platform_window_.reset(new ui::WinWindow(this, metrics_.bounds));
#elif defined(USE_X11)
platform_window_.reset(new ui::X11Window(this));
#elif defined(OS_ANDROID)
platform_window_.reset(new ui::PlatformWindowAndroid(this));
#elif defined(USE_OZONE)
- platform_window_ =
- ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds);
+ platform_window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow(
+ this, metrics_.bounds);
#else
NOTREACHED() << "Unsupported platform";
#endif
- platform_window_->SetBounds(bounds);
+ platform_window_->SetBounds(metrics_.bounds);
platform_window_->Show();
}
@@ -168,22 +167,28 @@ int64_t DefaultPlatformDisplay::GetDisplayId() const {
return display_id_;
}
-void DefaultPlatformDisplay::UpdateMetrics(const gfx::Size& size,
+gfx::Rect DefaultPlatformDisplay::GetBounds() const {
+ return metrics_.bounds;
+}
+
+void DefaultPlatformDisplay::UpdateMetrics(const gfx::Rect& bounds,
float device_scale_factor) {
if (display::Display::HasForceDeviceScaleFactor())
device_scale_factor = display::Display::GetForcedDeviceScaleFactor();
- if (metrics_.size_in_pixels == size &&
+ if (metrics_.bounds == bounds &&
metrics_.device_scale_factor == device_scale_factor)
return;
ViewportMetrics old_metrics = metrics_;
- metrics_.size_in_pixels = size;
+ metrics_.bounds = bounds;
metrics_.device_scale_factor = device_scale_factor;
delegate_->OnViewportMetricsChanged(old_metrics, metrics_);
}
void DefaultPlatformDisplay::OnBoundsChanged(const gfx::Rect& new_bounds) {
- UpdateMetrics(new_bounds.size(), metrics_.device_scale_factor);
+ // TODO(kylechar): We should keep track of the actual top left of the window
+ // and also the internal top left of the window (eg. first window is at 0,0).
+ UpdateMetrics(new_bounds, metrics_.device_scale_factor);
}
void DefaultPlatformDisplay::OnDamageRect(const gfx::Rect& damaged_region) {
@@ -248,7 +253,7 @@ void DefaultPlatformDisplay::OnAcceleratedWidgetAvailable(
gfx::AcceleratedWidget widget,
float device_scale_factor) {
frame_generator_->OnAcceleratedWidgetAvailable(widget);
- UpdateMetrics(metrics_.size_in_pixels, device_scale_factor);
+ UpdateMetrics(metrics_.bounds, device_scale_factor);
}
void DefaultPlatformDisplay::OnAcceleratedWidgetDestroyed() {
« no previous file with comments | « services/ui/ws/platform_display.h ('k') | services/ui/ws/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698