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

Side by Side Diff: ui/display/android/screen_android.cc

Issue 2416403002: Reland of Android: support multiple displays on C++ side (Closed)
Patch Set: Rebased and fixed webkit_tests Created 4 years 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 unified diff | Download patch
« no previous file with comments | « ui/display/BUILD.gn ('k') | ui/display/screen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/logging.h"
6 #include "base/macros.h"
7 #include "ui/display/display.h"
8 #include "ui/display/screen_base.h"
9 #include "ui/gfx/android/device_display_info.h"
10 #include "ui/gfx/geometry/size_conversions.h"
11
12 namespace display {
13
14 class ScreenAndroid : public ScreenBase {
15 public:
16 ScreenAndroid() {
17 gfx::DeviceDisplayInfo device_info;
18 const float device_scale_factor = device_info.GetDIPScale();
19 // Note: GetPhysicalDisplayWidth/Height() does not subtract window
20 // decorations etc. Use it instead of GetDisplayWidth/Height() when
21 // available.
22 const gfx::Rect bounds_in_pixels =
23 gfx::Rect(device_info.GetPhysicalDisplayWidth()
24 ? device_info.GetPhysicalDisplayWidth()
25 : device_info.GetDisplayWidth(),
26 device_info.GetPhysicalDisplayHeight()
27 ? device_info.GetPhysicalDisplayHeight()
28 : device_info.GetDisplayHeight());
29 const gfx::Rect bounds_in_dip = gfx::Rect(gfx::ScaleToCeiledSize(
30 bounds_in_pixels.size(), 1.0f / device_scale_factor));
31 Display display(0, bounds_in_dip);
32 if (!Display::HasForceDeviceScaleFactor())
33 display.set_device_scale_factor(device_scale_factor);
34 display.SetRotationAsDegree(device_info.GetRotationDegrees());
35 display.set_color_depth(device_info.GetBitsPerPixel());
36 display.set_depth_per_component(device_info.GetBitsPerComponent());
37 display.set_is_monochrome(device_info.GetBitsPerComponent() == 0);
38 ProcessDisplayChanged(display, true /* is_primary */);
39 }
40
41 gfx::Point GetCursorScreenPoint() override { return gfx::Point(); }
42
43 bool IsWindowUnderCursor(gfx::NativeWindow window) override {
44 NOTIMPLEMENTED();
45 return false;
46 }
47
48 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override {
49 NOTIMPLEMENTED();
50 return NULL;
51 }
52
53 Display GetDisplayNearestWindow(gfx::NativeView view) const override {
54 return GetPrimaryDisplay();
55 }
56
57 private:
58 DISALLOW_COPY_AND_ASSIGN(ScreenAndroid);
59 };
60
61 Screen* CreateNativeScreen() {
62 return new ScreenAndroid;
63 }
64
65 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/BUILD.gn ('k') | ui/display/screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698