Commit d768e9a9 authored by kylechar's avatar kylechar Committed by Commit bot

Pass device scale factor from display to ws in mustash.

Pass extra info from PlatfromScreen to it's delegate so that the device
bounds in DIP, the pixel size and device scale factor are available. The
the delegate happens to be the WS and it will use this information to
support high-DPI displays.

Most of the changes inside PlatformScreenOzone are throw away.
ash::DisplayManager already has this logic. We still have to finish
separating ash::DisplayManager from the rest of ash though,
necessitating a bit of code duplication until then.

The bounds of the display are in DIP. This is the format that is
expected from clients that receive the bounds via ScreenMus. The pixel
size of the display is needed for creating the PlatformWindow.

With this change mustash should run in high-DPI mode when running on a
device with a high-DPI internal display. It can also be enabled by
specifying the DPI for the fake display in Ozone X11, for example
--screen-config=800x800^300 will be high-DPI.

BUG=649008

Review-Url: https://codereview.chromium.org/2356913002
Cr-Commit-Position: refs/heads/master@{#420757}
parent e9a527e0
kylechar@chromium.org
rjkroege@chromium.org
......@@ -9,6 +9,7 @@
namespace gfx {
class Rect;
class Size;
}
namespace display {
......@@ -19,17 +20,25 @@ class PlatformScreen;
// and/or virtual displays by PlatformScreen.
class PlatformScreenDelegate {
public:
// TODO(kylechar): We need to provide more than just the window bounds when
// displays are added or modified.
// Called when a display is added. |bounds| is in DIP.
virtual void OnDisplayAdded(int64_t id, const gfx::Rect& bounds) = 0;
// Called when a display is removed.
// Called when a display is added. |id| is the display id for the new display,
// |bounds| is the display origin and size in DIP, |pixel_size| is the size
// of the display in DDP and |device_scale_factor| is the output device pixel
// scale factor.
virtual void OnDisplayAdded(int64_t id,
const gfx::Rect& bounds,
const gfx::Size& pixel_size,
float device_scale_factor) = 0;
// Called when a display is removed. |id| is the display id for the display
// that was removed.
virtual void OnDisplayRemoved(int64_t id) = 0;
// Called when a display is modified. |bounds| is in DIP.
virtual void OnDisplayModified(int64_t id, const gfx::Rect& bounds) = 0;
// Called when a display is modified. See OnDisplayAdded() for parameter
// information.
virtual void OnDisplayModified(int64_t id,
const gfx::Rect& bounds,
const gfx::Size& pixel_size,
float device_scale_factor) = 0;
protected:
virtual ~PlatformScreenDelegate() {}
......
......@@ -25,6 +25,28 @@ namespace {
// Needed for DisplayConfigurator::ForceInitialConfigure.
const SkColor kChromeOsBootColor = SkColorSetRGB(0xfe, 0xfe, 0xfe);
const float kInchInMm = 25.4f;
float ComputeDisplayDPI(const gfx::Size& pixel_size,
const gfx::Size& physical_size) {
DCHECK(!physical_size.IsEmpty());
return (pixel_size.width() / static_cast<float>(physical_size.width())) *
kInchInMm;
}
// Finds the device scale factor based on the display DPI. Will use forced
// device scale factor if provided via command line.
float FindDeviceScaleFactor(float dpi) {
if (Display::HasForceDeviceScaleFactor())
return Display::GetForcedDeviceScaleFactor();
// TODO(kylechar): If dpi > 150 then ash uses 1.25 now. Ignoring that for now.
if (dpi > 200.0)
return 2.0f;
else
return 1.0f;
}
} // namespace
// static
......@@ -86,9 +108,9 @@ void PlatformScreenOzone::ToggleVirtualDisplay() {
return;
if (cached_displays_.size() == 1) {
const gfx::Size& display_size = cached_displays_[0].bounds.size();
const gfx::Size& pixel_size = cached_displays_[0].pixel_size;
wait_for_display_config_update_ =
fake_display_controller_->AddDisplay(display_size) !=
fake_display_controller_->AddDisplay(pixel_size) !=
Display::kInvalidDisplayID;
} else if (cached_displays_.size() > 1) {
wait_for_display_config_update_ =
......@@ -110,12 +132,12 @@ void PlatformScreenOzone::ProcessRemovedDisplays(
current_ids.end()) {
display.removed = true;
if (primary_display_id_ == display.id)
primary_display_id_ = display::Display::kInvalidDisplayID;
primary_display_id_ = Display::kInvalidDisplayID;
}
}
// If the primary display was removed find a new primary display id.
if (primary_display_id_ == display::Display::kInvalidDisplayID) {
if (primary_display_id_ == Display::kInvalidDisplayID) {
for (const DisplayInfo& display : cached_displays_) {
if (!display.removed) {
primary_display_id_ = display.id;
......@@ -131,9 +153,11 @@ void PlatformScreenOzone::ProcessModifiedDisplays(
auto iter = GetCachedDisplayIterator(snapshot->display_id());
if (iter != cached_displays_.end()) {
DisplayInfo& display_info = *iter;
const ui::DisplayMode* current_mode = snapshot->current_mode();
if (current_mode->size() != display_info.bounds.size()) {
display_info.bounds.set_size(current_mode->size());
DisplayInfo new_info = DisplayInfoFromSnapshot(*snapshot);
if (new_info.bounds.size() != display_info.bounds.size() ||
new_info.device_scale_factor != display_info.device_scale_factor) {
display_info = new_info;
display_info.modified = true;
}
}
......@@ -162,7 +186,9 @@ void PlatformScreenOzone::UpdateCachedDisplays() {
// Check if the window bounds have changed and update delegate.
if (display_info.modified) {
display_info.modified = false;
delegate_->OnDisplayModified(display_info.id, display_info.bounds);
delegate_->OnDisplayModified(display_info.id, display_info.bounds,
display_info.pixel_size,
display_info.device_scale_factor);
}
++iter;
}
......@@ -178,18 +204,19 @@ void PlatformScreenOzone::AddNewDisplays(
if (GetCachedDisplayIterator(id) != cached_displays_.end())
continue;
const ui::DisplayMode* current_mode = snapshot->current_mode();
gfx::Rect bounds(next_display_origin_, current_mode->size());
// Move the origin so that next display is to the right of current display.
next_display_origin_.Offset(current_mode->size().width(), 0);
// If we have no primary display then this one should be it.
if (primary_display_id_ == display::Display::kInvalidDisplayID)
if (primary_display_id_ == Display::kInvalidDisplayID)
primary_display_id_ = id;
cached_displays_.push_back(DisplayInfo(id, bounds));
delegate_->OnDisplayAdded(id, bounds);
DisplayInfo display_info = DisplayInfoFromSnapshot(*snapshot);
// Move the origin so that next display is to the right of current display.
next_display_origin_.Offset(display_info.bounds.width(), 0);
cached_displays_.push_back(display_info);
delegate_->OnDisplayAdded(display_info.id, display_info.bounds,
display_info.pixel_size,
display_info.device_scale_factor);
}
}
......@@ -201,6 +228,24 @@ PlatformScreenOzone::GetCachedDisplayIterator(int64_t display_id) {
});
}
PlatformScreenOzone::DisplayInfo PlatformScreenOzone::DisplayInfoFromSnapshot(
const ui::DisplaySnapshot& snapshot) {
const ui::DisplayMode* current_mode = snapshot.current_mode();
DCHECK(current_mode);
DisplayInfo display_info;
display_info.id = snapshot.display_id();
display_info.pixel_size = current_mode->size();
display_info.device_scale_factor = FindDeviceScaleFactor(
ComputeDisplayDPI(current_mode->size(), snapshot.physical_size()));
// Get DIP size based on device scale factor. We are assuming the
// ui scale factor is always 1.0 here for now.
gfx::Size scaled_size = gfx::ScaleToRoundedSize(
current_mode->size(), 1.0f / display_info.device_scale_factor);
display_info.bounds = gfx::Rect(next_display_origin_, scaled_size);
return display_info;
}
void PlatformScreenOzone::OnDisplayModeChanged(
const ui::DisplayConfigurator::DisplayStateList& displays) {
ProcessRemovedDisplays(displays);
......
......@@ -47,12 +47,13 @@ class PlatformScreenOzone
// TODO(kylechar): This struct is just temporary until we migrate
// DisplayManager code out of ash so it can be used here.
struct DisplayInfo {
DisplayInfo(int64_t new_id, const gfx::Rect& new_bounds)
: id(new_id), bounds(new_bounds) {}
int64_t id;
// The display bounds.
int64_t id = Display::kInvalidDisplayID;
// The display bounds in DIP.
gfx::Rect bounds;
// Display size in DDP.
gfx::Size pixel_size;
// The display device pixel scale factor, either 1 or 2.
float device_scale_factor = 1.0f;
// The display bounds have been modified and delegate should be updated.
bool modified = false;
// The display has been removed and delegate should be updated.
......@@ -90,6 +91,9 @@ class PlatformScreenOzone
// iterator if there is no display with that id.
CachedDisplayIterator GetCachedDisplayIterator(int64_t display_id);
// Converts |snapshot| into a DisplayInfo.
DisplayInfo DisplayInfoFromSnapshot(const ui::DisplaySnapshot& snapshot);
// ui::DisplayConfigurator::Observer:
void OnDisplayModeChanged(
const ui::DisplayConfigurator::DisplayStateList& displays) override;
......
......@@ -38,6 +38,8 @@ const int64_t kDefaultDisplayId = 1;
struct DisplayState {
int64_t id;
gfx::Rect bounds;
gfx::Size size;
float device_scale_factor;
};
// Matchers that operate on DisplayState.
......@@ -83,16 +85,22 @@ class TestPlatformScreenDelegate : public PlatformScreenDelegate {
}
private:
void OnDisplayAdded(int64_t id, const gfx::Rect& bounds) override {
added_.push_back({id, bounds});
void OnDisplayAdded(int64_t id,
const gfx::Rect& bounds,
const gfx::Size& pixel_size,
float device_scale_factor) override {
added_.push_back({id, bounds, pixel_size, device_scale_factor});
}
void OnDisplayRemoved(int64_t id) override {
removed_.push_back({id, gfx::Rect()});
removed_.push_back({id, gfx::Rect(), gfx::Size(), 1.0f});
}
void OnDisplayModified(int64_t id, const gfx::Rect& bounds) override {
modified_.push_back({id, bounds});
void OnDisplayModified(int64_t id,
const gfx::Rect& bounds,
const gfx::Size& pixel_size,
float device_scale_factor) override {
modified_.push_back({id, bounds, pixel_size, device_scale_factor});
}
std::vector<DisplayState> added_;
......
......@@ -11,12 +11,15 @@
#include "base/memory/ptr_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "services/shell/public/cpp/interface_registry.h"
#include "ui/display/display.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
namespace display {
namespace {
const int64_t kDisplayId = 1;
constexpr gfx::Size kDisplaySize(1024, 768);
} // namespace
......@@ -30,7 +33,14 @@ PlatformScreenStub::PlatformScreenStub() : weak_ptr_factory_(this) {}
PlatformScreenStub::~PlatformScreenStub() {}
void PlatformScreenStub::FixedSizeScreenConfiguration() {
delegate_->OnDisplayAdded(kDisplayId, gfx::Rect(1024, 768));
float device_scale_factor = 1.0f;
if (Display::HasForceDeviceScaleFactor())
device_scale_factor = Display::GetForcedDeviceScaleFactor();
gfx::Size scaled_size =
gfx::ScaleToRoundedSize(kDisplaySize, 1.0f / device_scale_factor);
delegate_->OnDisplayAdded(kDisplayId, gfx::Rect(scaled_size), kDisplaySize,
device_scale_factor);
}
void PlatformScreenStub::AddInterfaces(shell::InterfaceRegistry* registry) {}
......
......@@ -81,6 +81,7 @@ static_library("lib") {
"user_id_tracker.cc",
"user_id_tracker.h",
"user_id_tracker_observer.h",
"viewport_metrics.h",
"window_coordinate_conversions.cc",
"window_coordinate_conversions.h",
"window_finder.cc",
......
......@@ -285,6 +285,19 @@ void Display::CreateWindowManagerDisplayRootFromFactory(
std::move(display_root_ptr));
}
void Display::CreateRootWindow(const gfx::Size& size) {
DCHECK(!root_);
root_.reset(window_server_->CreateServerWindow(
display_manager()->GetAndAdvanceNextRootId(),
ServerWindow::Properties()));
root_->SetBounds(gfx::Rect(size));
root_->SetVisible(true);
focus_controller_.reset(new FocusController(this, root_.get()));
focus_controller_->AddObserver(this);
InitWindowManagerDisplayRootsIfNecessary();
}
ServerWindow* Display::GetRootWindow() {
return root_.get();
}
......@@ -311,23 +324,15 @@ void Display::OnNativeCaptureLost() {
void Display::OnViewportMetricsChanged(const ViewportMetrics& old_metrics,
const ViewportMetrics& new_metrics) {
if (!root_)
return;
gfx::Rect new_bounds(new_metrics.bounds.size());
if (!root_) {
root_.reset(window_server_->CreateServerWindow(
display_manager()->GetAndAdvanceNextRootId(),
ServerWindow::Properties()));
root_->SetBounds(new_bounds);
root_->SetVisible(true);
focus_controller_.reset(new FocusController(this, root_.get()));
focus_controller_->AddObserver(this);
InitWindowManagerDisplayRootsIfNecessary();
} else {
root_->SetBounds(new_bounds);
for (auto& pair : window_manager_display_root_map_)
pair.second->root()->SetBounds(new_bounds);
}
if (init_called_)
display_manager()->OnDisplayUpdate(this);
root_->SetBounds(new_bounds);
for (auto& pair : window_manager_display_root_map_)
pair.second->root()->SetBounds(new_bounds);
display_manager()->OnDisplayUpdate(this);
}
void Display::OnCompositorFrameDrawn() {
......
......@@ -168,6 +168,7 @@ class Display : public PlatformDisplayDelegate,
WindowManagerWindowTreeFactory* factory);
// PlatformDisplayDelegate:
void CreateRootWindow(const gfx::Size& size) override;
ServerWindow* GetRootWindow() override;
bool IsInHighContrastMode() override;
void OnEvent(const ui::Event& event) override;
......
......@@ -5,6 +5,7 @@
#include "services/ui/ws/display_manager.h"
#include "base/memory/ptr_util.h"
#include "base/trace_event/trace_event.h"
#include "services/ui/display/platform_screen.h"
#include "services/ui/ws/display.h"
#include "services/ui/ws/display_binding.h"
......@@ -166,10 +167,16 @@ void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id,
current_window_manager_state->Activate(mouse_location_on_screen);
}
void DisplayManager::OnDisplayAdded(int64_t id, const gfx::Rect& bounds) {
void DisplayManager::OnDisplayAdded(int64_t id,
const gfx::Rect& bounds,
const gfx::Size& pixel_size,
float scale_factor) {
TRACE_EVENT1("mus-ws", "OnDisplayAdded", "id", id);
PlatformDisplayInitParams params;
params.display_bounds = bounds;
params.display_id = id;
params.metrics.bounds = bounds;
params.metrics.pixel_size = pixel_size;
params.metrics.device_scale_factor = scale_factor;
params.surfaces_state = window_server_->GetSurfacesState();
ws::Display* display = new ws::Display(window_server_, params);
......@@ -179,12 +186,16 @@ void DisplayManager::OnDisplayAdded(int64_t id, const gfx::Rect& bounds) {
}
void DisplayManager::OnDisplayRemoved(int64_t id) {
TRACE_EVENT1("mus-ws", "OnDisplayRemoved", "id", id);
Display* display = GetDisplayById(id);
if (display)
DestroyDisplay(display);
}
void DisplayManager::OnDisplayModified(int64_t id, const gfx::Rect& bounds) {
void DisplayManager::OnDisplayModified(int64_t id,
const gfx::Rect& bounds,
const gfx::Size& pixel_size,
float scale_factor) {
// TODO(kylechar): Implement.
NOTREACHED();
}
......
......@@ -82,9 +82,15 @@ class DisplayManager : public UserIdTrackerObserver,
const UserId& active_id) override;
// display::PlatformScreenDelegate:
void OnDisplayAdded(int64_t id, const gfx::Rect& bounds) override;
void OnDisplayAdded(int64_t id,
const gfx::Rect& bounds,
const gfx::Size& pixel_size,
float scale_factor) override;
void OnDisplayRemoved(int64_t id) override;
void OnDisplayModified(int64_t id, const gfx::Rect& bounds) override;
void OnDisplayModified(int64_t id,
const gfx::Rect& bounds,
const gfx::Size& pixel_size,
float scale_factor) override;
WindowServer* window_server_;
UserIdTracker* user_id_tracker_;
......
......@@ -84,7 +84,7 @@ void FrameGenerator::Draw() {
return;
const ViewportMetrics& metrics = delegate_->GetViewportMetrics();
const gfx::Rect output_rect(metrics.bounds.size());
const gfx::Rect output_rect(metrics.pixel_size);
dirty_rect_.Intersect(output_rect);
// TODO(fsamuel): We should add a trace for generating a top level frame.
cc::CompositorFrame frame(GenerateCompositorFrame(output_rect));
......
......@@ -6,17 +6,13 @@
#define SERVICES_UI_WS_FRAME_GENERATOR_DELEGATE_H_
#include "base/macros.h"
#include "services/ui/ws/viewport_metrics.h"
namespace ui {
namespace ws {
class ServerWindow;
struct ViewportMetrics {
gfx::Rect bounds;
float device_scale_factor = 0.f;
};
class FrameGeneratorDelegate {
public:
// Returns the root window of the display.
......
......@@ -59,26 +59,33 @@ DefaultPlatformDisplay::DefaultPlatformDisplay(
#if !defined(OS_ANDROID)
cursor_loader_(ui::CursorLoader::Create()),
#endif
frame_generator_(new FrameGenerator(this, init_params.surfaces_state)) {
metrics_.bounds = init_params.display_bounds;
frame_generator_(new FrameGenerator(this, init_params.surfaces_state)),
metrics_(init_params.metrics) {
}
void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) {
delegate_ = delegate;
DCHECK(!metrics_.pixel_size.IsEmpty());
// TODO(kylechar): The origin here isn't right if any displays have
// scale_factor other than 1.0 but will prevent windows from being stacked.
gfx::Rect bounds(metrics_.bounds.origin(), metrics_.pixel_size);
#if defined(OS_WIN)
platform_window_.reset(new ui::WinWindow(this, metrics_.bounds));
platform_window_.reset(new ui::WinWindow(this, 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, metrics_.bounds);
platform_window_ =
ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds);
#else
NOTREACHED() << "Unsupported platform";
#endif
platform_window_->SetBounds(metrics_.bounds);
delegate_->CreateRootWindow(metrics_.bounds.size());
platform_window_->SetBounds(bounds);
platform_window_->Show();
}
......@@ -178,20 +185,17 @@ void DefaultPlatformDisplay::OnGpuChannelEstablished(
}
void DefaultPlatformDisplay::UpdateMetrics(const gfx::Rect& bounds,
const gfx::Size& pixel_size,
float device_scale_factor) {
if (display::Display::HasForceDeviceScaleFactor())
device_scale_factor = display::Display::GetForcedDeviceScaleFactor();
// We don't care about the origin of the platform window, as that may not be
// related to the origin of the display in our screen space.
if (metrics_.bounds.size() == bounds.size() &&
if (metrics_.bounds == bounds && metrics_.pixel_size == pixel_size &&
metrics_.device_scale_factor == device_scale_factor)
return;
// TODO(kylechar): If the window size is updated then we may need to update
// the origin for any other windows.
ViewportMetrics old_metrics = metrics_;
metrics_.bounds.set_size(bounds.size());
metrics_.bounds = bounds;
metrics_.pixel_size = pixel_size;
metrics_.device_scale_factor = device_scale_factor;
delegate_->OnViewportMetricsChanged(old_metrics, metrics_);
}
......@@ -203,7 +207,12 @@ void DefaultPlatformDisplay::UpdateEventRootLocation(ui::LocatedEvent* event) {
}
void DefaultPlatformDisplay::OnBoundsChanged(const gfx::Rect& new_bounds) {
UpdateMetrics(new_bounds, metrics_.device_scale_factor);
// TODO(kylechar): We're updating the bounds assuming that the device scale
// factor is 1 here. The correct thing to do is let PlatformSreen know the
// display size has changed and let it update the display.
gfx::Size pixel_size = new_bounds.size();
gfx::Rect bounds = gfx::Rect(metrics_.bounds.origin(), pixel_size);
UpdateMetrics(bounds, pixel_size, metrics_.device_scale_factor);
}
void DefaultPlatformDisplay::OnDamageRect(const gfx::Rect& damaged_region) {
......@@ -271,7 +280,6 @@ void DefaultPlatformDisplay::OnAcceleratedWidgetAvailable(
gfx::AcceleratedWidget widget,
float device_scale_factor) {
frame_generator_->OnAcceleratedWidgetAvailable(widget);
UpdateMetrics(metrics_.bounds, device_scale_factor);
}
void DefaultPlatformDisplay::OnAcceleratedWidgetDestroyed() {
......
......@@ -143,7 +143,9 @@ class DefaultPlatformDisplay : public PlatformDisplay,
scoped_refptr<gpu::GpuChannelHost> gpu_channel) override;
private:
void UpdateMetrics(const gfx::Rect& bounds, float device_scale_factor);
void UpdateMetrics(const gfx::Rect& bounds,
const gfx::Size& pixel_size,
float device_scale_factor);
// Update the root_location of located events to be relative to the origin
// of this display. For example, if the origin of this display is (1800, 0)
......
......@@ -5,14 +5,14 @@
#ifndef SERVICES_UI_WS_PLATFORM_DISPLAY_DELEGATE_H_
#define SERVICES_UI_WS_PLATFORM_DISPLAY_DELEGATE_H_
#include "services/ui/ws/ids.h"
namespace ui {
class Event;
namespace gfx {
class Size;
}
namespace ui {
class Event;
namespace ws {
class ServerWindow;
......@@ -23,6 +23,10 @@ struct ViewportMetrics;
/// and responses to changes in viewport size.
class PlatformDisplayDelegate {
public:
// Creates the root window for this display. The new root window will have
// |size| in DIP initially.
virtual void CreateRootWindow(const gfx::Size& size) = 0;
// Returns the root window of this display.
virtual ServerWindow* GetRootWindow() = 0;
......
......@@ -4,17 +4,15 @@
#include "services/ui/ws/platform_display_init_params.h"
#include "services/ui/display/platform_screen.h"
#include "services/ui/surfaces/surfaces_state.h"
#include "ui/display/display.h"
namespace ui {
namespace ws {
PlatformDisplayInitParams::PlatformDisplayInitParams()
: display_bounds(gfx::Rect(0, 0, 1024, 768)), display_id(1) {}
: display_id(display::Display::kInvalidDisplayID) {}
PlatformDisplayInitParams::PlatformDisplayInitParams(
const PlatformDisplayInitParams& other) = default;
PlatformDisplayInitParams::~PlatformDisplayInitParams() {}
} // namespace ws
......
......@@ -8,28 +8,21 @@
#include <stdint.h>
#include "base/memory/ref_counted.h"
#include "ui/gfx/geometry/rect.h"
namespace shell {
class Connector;
}
#include "services/ui/ws/viewport_metrics.h"
namespace ui {
class GpuState;
class SurfacesState;
namespace ws {
struct PlatformDisplayInitParams {
PlatformDisplayInitParams();
PlatformDisplayInitParams(const PlatformDisplayInitParams& other);
~PlatformDisplayInitParams();
scoped_refptr<SurfacesState> surfaces_state;
gfx::Rect display_bounds;
int64_t display_id;
ViewportMetrics metrics;
};
} // namespace ws
......
......@@ -41,10 +41,7 @@ class TestPlatformDisplay : public PlatformDisplay {
// PlatformDisplay:
void Init(PlatformDisplayDelegate* delegate) override {
// It is necessary to tell the delegate about the ViewportMetrics to make
// sure that the DisplayBinding is correctly initialized (and a root-window
// is created).
delegate->OnViewportMetricsChanged(ViewportMetrics(), display_metrics_);
delegate->CreateRootWindow(display_metrics_.bounds.size());
}
int64_t GetId() const override { return id_; }
void SchedulePaint(const ServerWindow* window,
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_UI_WS_VIEWPORT_METRICS_H_
#define SERVICES_UI_WS_VIEWPORT_METRICS_H_
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
namespace ui {
namespace ws {
struct ViewportMetrics {
gfx::Rect bounds; // DIP.
gfx::Size pixel_size;
float device_scale_factor = 0.0f;
};
} // namespace ws
} // namespace ui
#endif // SERVICES_UI_WS_VIEWPORT_METRICS_H_
......@@ -15,6 +15,10 @@ namespace ws {
WindowTreeHostFactory::WindowTreeHostFactory(WindowServer* window_server,
const UserId& user_id)
: window_server_(window_server), user_id_(user_id) {
platform_display_init_params_.metrics.bounds.set_width(1024);
platform_display_init_params_.metrics.bounds.set_height(768);
platform_display_init_params_.metrics.pixel_size.SetSize(1024, 768);
platform_display_init_params_.metrics.device_scale_factor = 1.0f;
platform_display_init_params_.surfaces_state =
window_server_->GetSurfacesState();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment