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

Unified Diff: ui/gfx/win/screen_win_display.cc

Issue 1639623003: ScreenWin Testability and Restructuring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync + VS2015 Friendly - struct -> class to maintain immutability Created 4 years, 10 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 | « ui/gfx/win/screen_win_display.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/win/screen_win_display.cc
diff --git a/ui/gfx/win/screen_win_display.cc b/ui/gfx/win/screen_win_display.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ccef28aafc0279aa73ce71c36cafd12962cf25f0
--- /dev/null
+++ b/ui/gfx/win/screen_win_display.cc
@@ -0,0 +1,38 @@
+// 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.
+
+#include "ui/gfx/win/screen_win_display.h"
+
+#include "ui/gfx/win/display_info.h"
+#include "ui/gfx/win/dpi.h"
+
+namespace {
+
+gfx::Display CreateDisplayFromDisplayInfo(
+ const gfx::win::DisplayInfo& display_info) {
+ gfx::Display display(display_info.id());
+ gfx::Rect dip_screen_bounds(
+ gfx::win::ScreenToDIPRect(display_info.screen_rect()));
+ display.set_bounds(dip_screen_bounds);
+ display.set_work_area(
+ gfx::win::ScreenToDIPRect(display_info.screen_work_rect()));
+ display.SetScaleAndBounds(display_info.device_scale_factor(),
+ display_info.screen_rect());
+ display.set_rotation(display_info.rotation());
+ return display;
+}
+
+} // namespace
+
+namespace gfx {
+namespace win {
+
+ScreenWinDisplay::ScreenWinDisplay() = default;
+
+ScreenWinDisplay::ScreenWinDisplay(const DisplayInfo& display_info)
+ : display_(CreateDisplayFromDisplayInfo(display_info)),
+ pixel_bounds_(display_info.screen_rect()) {}
+
+} // namespace win
+} // namespace gfx
« no previous file with comments | « ui/gfx/win/screen_win_display.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698