OLD | NEW |
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_DISPLAY_DISPLAY_H_ | 5 #ifndef UI_DISPLAY_DISPLAY_H_ |
6 #define UI_DISPLAY_DISPLAY_H_ | 6 #define UI_DISPLAY_DISPLAY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // Sets the display's size. This updates the work area using the same insets | 131 // Sets the display's size. This updates the work area using the same insets |
132 // between old bounds and work area. | 132 // between old bounds and work area. |
133 void SetSize(const gfx::Size& size_in_pixel); | 133 void SetSize(const gfx::Size& size_in_pixel); |
134 | 134 |
135 // Computes and updates the display's work are using | 135 // Computes and updates the display's work are using |
136 // |work_area_insets| and the bounds. | 136 // |work_area_insets| and the bounds. |
137 void UpdateWorkAreaFromInsets(const gfx::Insets& work_area_insets); | 137 void UpdateWorkAreaFromInsets(const gfx::Insets& work_area_insets); |
138 | 138 |
139 // Returns the display's size in pixel coordinates. | 139 // Returns the display's size in pixel coordinates. |
140 gfx::Size GetSizeInPixel() const; | 140 gfx::Size GetSizeInPixel() const; |
| 141 void set_size_in_pixels(const gfx::Size& size) { size_in_pixels_ = size; } |
141 | 142 |
142 // Returns a string representation of the display; | 143 // Returns a string representation of the display; |
143 std::string ToString() const; | 144 std::string ToString() const; |
144 | 145 |
145 // True if the display contains valid display id. | 146 // True if the display contains valid display id. |
146 bool is_valid() const { return id_ != kInvalidDisplayId; } | 147 bool is_valid() const { return id_ != kInvalidDisplayId; } |
147 | 148 |
148 // True if the display corresponds to internal panel. | 149 // True if the display corresponds to internal panel. |
149 bool IsInternal() const; | 150 bool IsInternal() const; |
150 | 151 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // True if this is a monochrome display (e.g, for accessiblity). Used by media | 187 // True if this is a monochrome display (e.g, for accessiblity). Used by media |
187 // query APIs. | 188 // query APIs. |
188 bool is_monochrome() const { return is_monochrome_; } | 189 bool is_monochrome() const { return is_monochrome_; } |
189 void set_is_monochrome(bool is_monochrome) { | 190 void set_is_monochrome(bool is_monochrome) { |
190 is_monochrome_ = is_monochrome; | 191 is_monochrome_ = is_monochrome; |
191 } | 192 } |
192 | 193 |
193 private: | 194 private: |
194 int64_t id_; | 195 int64_t id_; |
195 gfx::Rect bounds_; | 196 gfx::Rect bounds_; |
| 197 // If non-empty, then should be same size as |bounds_|. Used to avoid rounding |
| 198 // errors. |
| 199 gfx::Size size_in_pixels_; |
196 gfx::Rect work_area_; | 200 gfx::Rect work_area_; |
197 float device_scale_factor_; | 201 float device_scale_factor_; |
198 Rotation rotation_ = ROTATE_0; | 202 Rotation rotation_ = ROTATE_0; |
199 TouchSupport touch_support_ = TOUCH_SUPPORT_UNKNOWN; | 203 TouchSupport touch_support_ = TOUCH_SUPPORT_UNKNOWN; |
200 gfx::Size maximum_cursor_size_; | 204 gfx::Size maximum_cursor_size_; |
201 gfx::ICCProfile icc_profile_; | 205 gfx::ICCProfile icc_profile_; |
202 int color_depth_; | 206 int color_depth_; |
203 int depth_per_component_; | 207 int depth_per_component_; |
204 bool is_monochrome_ = false; | 208 bool is_monochrome_ = false; |
205 | 209 |
206 #if !defined(OS_IOS) | 210 #if !defined(OS_IOS) |
207 friend struct mojo::StructTraits<display::mojom::DisplayDataView, | 211 friend struct mojo::StructTraits<display::mojom::DisplayDataView, |
208 display::Display>; | 212 display::Display>; |
209 #endif | 213 #endif |
210 }; | 214 }; |
211 | 215 |
212 } // namespace display | 216 } // namespace display |
213 | 217 |
214 #endif // UI_DISPLAY_DISPLAY_H_ | 218 #endif // UI_DISPLAY_DISPLAY_H_ |
OLD | NEW |