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

Side by Side Diff: ui/gfx/display.h

Issue 10540091: Rename gfx::Monitor to gfx::Display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_MONITOR_H_ 5 #ifndef UI_GFX_DISPLAY_H_
6 #define UI_GFX_MONITOR_H_ 6 #define UI_GFX_DISPLAY_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "ui/base/ui_export.h" 11 #include "ui/base/ui_export.h"
12 #include "ui/gfx/rect.h" 12 #include "ui/gfx/rect.h"
13 13
14 namespace gfx { 14 namespace gfx {
15 15
16 // Note: The screen and monitor currently uses pixel coordinate 16 // Note: The screen and display currently uses pixel coordinate
17 // system. For platforms that support DIP (density independent pixel), 17 // system. For platforms that support DIP (density independent pixel),
18 // |bounds()| and |work_area| will return values in DIP coordinate 18 // |bounds()| and |work_area| will return values in DIP coordinate
19 // system, not in backing pixels. 19 // system, not in backing pixels.
20 class UI_EXPORT Monitor { 20 class UI_EXPORT Display {
21 public: 21 public:
22 // Returns the default value for the device scale factor, which is 22 // Returns the default value for the device scale factor, which is
23 // given by "--default-device-scale-factor". 23 // given by "--default-device-scale-factor".
24 static float GetDefaultDeviceScaleFactor(); 24 static float GetDefaultDeviceScaleFactor();
25 25
26 // Creates a monitor with invalid id(-1) as default. 26 // Creates a display with invalid id(-1) as default.
27 Monitor(); 27 Display();
28 explicit Monitor(int id); 28 explicit Display(int id);
29 Monitor(int id, const Rect& bounds); 29 Display(int id, const Rect& bounds);
30 ~Monitor(); 30 ~Display();
31 31
32 // Sets/Gets unique identifier associated with the monitor. 32 // Sets/Gets unique identifier associated with the display.
33 int id() const { return id_; } 33 int id() const { return id_; }
34 void set_id(int id) { id_ = id; } 34 void set_id(int id) { id_ = id; }
35 35
36 // Gets/Sets the monitor's bounds in gfx::Screen's coordinates. 36 // Gets/Sets the display's bounds in gfx::Screen's coordinates.
37 // -1 means invalid monitor and it doesn't not exit. 37 // -1 means invalid display and it doesn't not exit.
38 const Rect& bounds() const { return bounds_; } 38 const Rect& bounds() const { return bounds_; }
39 void set_bounds(const Rect& bounds) { bounds_ = bounds; } 39 void set_bounds(const Rect& bounds) { bounds_ = bounds; }
40 40
41 // Gets/Sets the monitor's work area in gfx::Screen's coordinates. 41 // Gets/Sets the display's work area in gfx::Screen's coordinates.
42 const Rect& work_area() const { return work_area_; } 42 const Rect& work_area() const { return work_area_; }
43 void set_work_area(const Rect& work_area) { work_area_ = work_area; } 43 void set_work_area(const Rect& work_area) { work_area_ = work_area; }
44 44
45 // Output device's pixel scale factor. This specifies how much the 45 // Output device's pixel scale factor. This specifies how much the
46 // UI should be scaled when the actual output has more pixels than 46 // UI should be scaled when the actual output has more pixels than
47 // standard monitors (which is around 100~120dpi.) The potential return 47 // standard displays (which is around 100~120dpi.) The potential return
48 // values depend on each platforms. 48 // values depend on each platforms.
49 float device_scale_factor() const { return device_scale_factor_; } 49 float device_scale_factor() const { return device_scale_factor_; }
50 void set_device_scale_factor(float scale) { device_scale_factor_ = scale; } 50 void set_device_scale_factor(float scale) { device_scale_factor_ = scale; }
51 51
52 // Utility functions that just return the size of monitor and 52 // Utility functions that just return the size of display and
53 // work area. 53 // work area.
54 const Size& size() const { return bounds_.size(); } 54 const Size& size() const { return bounds_.size(); }
55 const Size& work_area_size() const { return work_area_.size(); } 55 const Size& work_area_size() const { return work_area_.size(); }
56 56
57 // Returns the work area insets. 57 // Returns the work area insets.
58 Insets GetWorkAreaInsets() const; 58 Insets GetWorkAreaInsets() const;
59 59
60 // Sets the device scale factor and monitor bounds in pixel. This 60 // Sets the device scale factor and display bounds in pixel. This
61 // updates the work are using the same insets between old bounds and 61 // updates the work are using the same insets between old bounds and
62 // work area. 62 // work area.
63 void SetScaleAndBounds(float device_scale_factor, 63 void SetScaleAndBounds(float device_scale_factor,
64 const gfx::Rect& bounds_in_pixel); 64 const gfx::Rect& bounds_in_pixel);
65 65
66 // Sets the monitor's size. This updates the work area using the same insets 66 // Sets the display's size. This updates the work area using the same insets
67 // between old bounds and work area. 67 // between old bounds and work area.
68 void SetSize(const gfx::Size& size_in_pixel); 68 void SetSize(const gfx::Size& size_in_pixel);
69 69
70 // Computes and updates the monitor's work are using 70 // Computes and updates the display's work are using
71 // |work_area_insets| and the bounds. 71 // |work_area_insets| and the bounds.
72 void UpdateWorkAreaFromInsets(const gfx::Insets& work_area_insets); 72 void UpdateWorkAreaFromInsets(const gfx::Insets& work_area_insets);
73 73
74 // Returns the monitor's size in pixel coordinates. 74 // Returns the display's size in pixel coordinates.
75 gfx::Size GetSizeInPixel() const; 75 gfx::Size GetSizeInPixel() const;
76 76
77 #if defined(USE_AURA) 77 #if defined(USE_AURA)
78 // TODO(oshima): |bounds()| on ash is not screen's coordinate and 78 // TODO(oshima): |bounds()| on ash is not screen's coordinate and
79 // this is an workaround for this. This will be removed when ash 79 // this is an workaround for this. This will be removed when ash
80 // has true multi monitor support. crbug.com/119268. 80 // has true multi display support. crbug.com/119268.
81 // Returns the monitor's bounds in pixel coordinates. 81 // Returns the display's bounds in pixel coordinates.
82 const Rect& bounds_in_pixel() const { return bounds_in_pixel_; } 82 const Rect& bounds_in_pixel() const { return bounds_in_pixel_; }
83 #endif 83 #endif
84 84
85 // Returns a string representation of the monitor; 85 // Returns a string representation of the display;
86 std::string ToString() const; 86 std::string ToString() const;
87 87
88 private: 88 private:
89 int id_; 89 int id_;
90 Rect bounds_; 90 Rect bounds_;
91 Rect work_area_; 91 Rect work_area_;
92 #if defined(USE_AURA) 92 #if defined(USE_AURA)
93 Rect bounds_in_pixel_; 93 Rect bounds_in_pixel_;
94 #endif 94 #endif
95 float device_scale_factor_; 95 float device_scale_factor_;
96 }; 96 };
97 97
98 } // namespace gfx 98 } // namespace gfx
99 99
100 #endif // UI_GFX_MONITOR_H_ 100 #endif // UI_GFX_DISPLAY_H_
OLDNEW
« no previous file with comments | « ui/compositor/layer.cc ('k') | ui/gfx/display.cc » ('j') | ui/gfx/screen.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698