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

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

Issue 1543183002: Switch to standard integer types in ui/gfx/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « ui/gfx/color_utils.cc ('k') | ui/gfx/display.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_DISPLAY_H_ 5 #ifndef UI_GFX_DISPLAY_H_
6 #define UI_GFX_DISPLAY_H_ 6 #define UI_GFX_DISPLAY_H_
7 7
8 #include "base/basictypes.h" 8 #include <stdint.h>
9
9 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
10 #include "ui/gfx/geometry/rect.h" 11 #include "ui/gfx/geometry/rect.h"
11 #include "ui/gfx/gfx_export.h" 12 #include "ui/gfx/gfx_export.h"
12 13
13 namespace gfx { 14 namespace gfx {
14 15
15 // This class typically, but does not always, correspond to a physical display 16 // This class typically, but does not always, correspond to a physical display
16 // connected to the system. A fake Display may exist on a headless system, or a 17 // connected to the system. A fake Display may exist on a headless system, or a
17 // Display may correspond to a remote, virtual display. 18 // Display may correspond to a remote, virtual display.
18 // 19 //
(...skipping 25 matching lines...) Expand all
44 ROTATION_SOURCE_USER, 45 ROTATION_SOURCE_USER,
45 }; 46 };
46 47
47 // Touch support for the display. 48 // Touch support for the display.
48 enum TouchSupport { 49 enum TouchSupport {
49 TOUCH_SUPPORT_UNKNOWN, 50 TOUCH_SUPPORT_UNKNOWN,
50 TOUCH_SUPPORT_AVAILABLE, 51 TOUCH_SUPPORT_AVAILABLE,
51 TOUCH_SUPPORT_UNAVAILABLE, 52 TOUCH_SUPPORT_UNAVAILABLE,
52 }; 53 };
53 54
54 enum : int64 { kInvalidDisplayID = -1 }; 55 enum : int64_t { kInvalidDisplayID = -1 };
55 56
56 // Creates a display with kInvalidDisplayID as default. 57 // Creates a display with kInvalidDisplayID as default.
57 Display(); 58 Display();
58 explicit Display(int64 id); 59 explicit Display(int64_t id);
59 Display(int64 id, const Rect& bounds); 60 Display(int64_t id, const Rect& bounds);
60 ~Display(); 61 ~Display();
61 62
62 // Returns the forced device scale factor, which is given by 63 // Returns the forced device scale factor, which is given by
63 // "--force-device-scale-factor". 64 // "--force-device-scale-factor".
64 static float GetForcedDeviceScaleFactor(); 65 static float GetForcedDeviceScaleFactor();
65 66
66 // Indicates if a device scale factor is being explicitly enforced from the 67 // Indicates if a device scale factor is being explicitly enforced from the
67 // command line via "--force-device-scale-factor". 68 // command line via "--force-device-scale-factor".
68 static bool HasForceDeviceScaleFactor(); 69 static bool HasForceDeviceScaleFactor();
69 70
70 // Resets the caches used to determine if a device scale factor is being 71 // Resets the caches used to determine if a device scale factor is being
71 // forced from the command line via "--force-device-scale-factor", and thus 72 // forced from the command line via "--force-device-scale-factor", and thus
72 // ensures that the command line is reevaluated. 73 // ensures that the command line is reevaluated.
73 static void ResetForceDeviceScaleFactorForTesting(); 74 static void ResetForceDeviceScaleFactorForTesting();
74 75
75 // Sets/Gets unique identifier associated with the display. 76 // Sets/Gets unique identifier associated with the display.
76 // -1 means invalid display and it doesn't not exit. 77 // -1 means invalid display and it doesn't not exit.
77 int64 id() const { return id_; } 78 int64_t id() const { return id_; }
78 void set_id(int64 id) { id_ = id; } 79 void set_id(int64_t id) { id_ = id; }
79 80
80 // Gets/Sets the display's bounds in gfx::Screen's coordinates. 81 // Gets/Sets the display's bounds in gfx::Screen's coordinates.
81 const Rect& bounds() const { return bounds_; } 82 const Rect& bounds() const { return bounds_; }
82 void set_bounds(const Rect& bounds) { bounds_ = bounds; } 83 void set_bounds(const Rect& bounds) { bounds_ = bounds; }
83 84
84 // Gets/Sets the display's work area in gfx::Screen's coordinates. 85 // Gets/Sets the display's work area in gfx::Screen's coordinates.
85 const Rect& work_area() const { return work_area_; } 86 const Rect& work_area() const { return work_area_; }
86 void set_work_area(const Rect& work_area) { work_area_ = work_area; } 87 void set_work_area(const Rect& work_area) { work_area_ = work_area; }
87 88
88 // Output device's pixel scale factor. This specifies how much the 89 // Output device's pixel scale factor. This specifies how much the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Returns a string representation of the display; 129 // Returns a string representation of the display;
129 std::string ToString() const; 130 std::string ToString() const;
130 131
131 // True if the display contains valid display id. 132 // True if the display contains valid display id.
132 bool is_valid() const { return id_ != kInvalidDisplayID; } 133 bool is_valid() const { return id_ != kInvalidDisplayID; }
133 134
134 // True if the display corresponds to internal panel. 135 // True if the display corresponds to internal panel.
135 bool IsInternal() const; 136 bool IsInternal() const;
136 137
137 // Gets/Sets an id of display corresponding to internal panel. 138 // Gets/Sets an id of display corresponding to internal panel.
138 static int64 InternalDisplayId(); 139 static int64_t InternalDisplayId();
139 static void SetInternalDisplayId(int64 internal_display_id); 140 static void SetInternalDisplayId(int64_t internal_display_id);
140 141
141 // Test if the |id| is for the internal display if any. 142 // Test if the |id| is for the internal display if any.
142 static bool IsInternalDisplayId(int64 id); 143 static bool IsInternalDisplayId(int64_t id);
143 144
144 // True if there is an internal display. 145 // True if there is an internal display.
145 static bool HasInternalDisplay(); 146 static bool HasInternalDisplay();
146 147
147 private: 148 private:
148 int64 id_; 149 int64_t id_;
149 Rect bounds_; 150 Rect bounds_;
150 Rect work_area_; 151 Rect work_area_;
151 float device_scale_factor_; 152 float device_scale_factor_;
152 Rotation rotation_; 153 Rotation rotation_;
153 TouchSupport touch_support_; 154 TouchSupport touch_support_;
154 }; 155 };
155 156
156 } // namespace gfx 157 } // namespace gfx
157 158
158 #endif // UI_GFX_DISPLAY_H_ 159 #endif // UI_GFX_DISPLAY_H_
OLDNEW
« no previous file with comments | « ui/gfx/color_utils.cc ('k') | ui/gfx/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698