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

Unified Diff: services/ui/display/platform_screen_stub.cc

Issue 2356913002: Pass device scale factor from display to ws. (Closed)
Patch Set: Fix more tests. Created 4 years, 3 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/display/platform_screen_ozone_unittests.cc ('k') | services/ui/ws/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/display/platform_screen_stub.cc
diff --git a/services/ui/display/platform_screen_stub.cc b/services/ui/display/platform_screen_stub.cc
index 6a23e25b8547de2c6a109d5de46f68552c12d7db..b10be9ed857000692a621b2179610065a472ee78 100644
--- a/services/ui/display/platform_screen_stub.cc
+++ b/services/ui/display/platform_screen_stub.cc
@@ -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) {}
« no previous file with comments | « services/ui/display/platform_screen_ozone_unittests.cc ('k') | services/ui/ws/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698