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 #if defined(OS_ANDROID) |
| 142 void set_size_in_pixels(const gfx::Size& size) { size_in_pixels_ = size; } |
| 143 #endif // defined(OS_ANDROID) |
141 | 144 |
142 // Returns a string representation of the display; | 145 // Returns a string representation of the display; |
143 std::string ToString() const; | 146 std::string ToString() const; |
144 | 147 |
145 // True if the display contains valid display id. | 148 // True if the display contains valid display id. |
146 bool is_valid() const { return id_ != kInvalidDisplayId; } | 149 bool is_valid() const { return id_ != kInvalidDisplayId; } |
147 | 150 |
148 // True if the display corresponds to internal panel. | 151 // True if the display corresponds to internal panel. |
149 bool IsInternal() const; | 152 bool IsInternal() const; |
150 | 153 |
(...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 | 189 // True if this is a monochrome display (e.g, for accessiblity). Used by media |
187 // query APIs. | 190 // query APIs. |
188 bool is_monochrome() const { return is_monochrome_; } | 191 bool is_monochrome() const { return is_monochrome_; } |
189 void set_is_monochrome(bool is_monochrome) { | 192 void set_is_monochrome(bool is_monochrome) { |
190 is_monochrome_ = is_monochrome; | 193 is_monochrome_ = is_monochrome; |
191 } | 194 } |
192 | 195 |
193 private: | 196 private: |
194 int64_t id_; | 197 int64_t id_; |
195 gfx::Rect bounds_; | 198 gfx::Rect bounds_; |
| 199 // If non-empty, then should be same size as |bounds_|. Used to avoid rounding |
| 200 // errors. |
| 201 gfx::Size size_in_pixels_; |
196 gfx::Rect work_area_; | 202 gfx::Rect work_area_; |
197 float device_scale_factor_; | 203 float device_scale_factor_; |
198 Rotation rotation_ = ROTATE_0; | 204 Rotation rotation_ = ROTATE_0; |
199 TouchSupport touch_support_ = TOUCH_SUPPORT_UNKNOWN; | 205 TouchSupport touch_support_ = TOUCH_SUPPORT_UNKNOWN; |
200 gfx::Size maximum_cursor_size_; | 206 gfx::Size maximum_cursor_size_; |
201 gfx::ICCProfile icc_profile_; | 207 gfx::ICCProfile icc_profile_; |
202 int color_depth_; | 208 int color_depth_; |
203 int depth_per_component_; | 209 int depth_per_component_; |
204 bool is_monochrome_ = false; | 210 bool is_monochrome_ = false; |
205 | 211 |
206 #if !defined(OS_IOS) | 212 #if !defined(OS_IOS) |
207 friend struct mojo::StructTraits<mojom::DisplayDataView, Display>; | 213 friend struct mojo::StructTraits<mojom::DisplayDataView, Display>; |
208 #endif | 214 #endif |
209 }; | 215 }; |
210 | 216 |
211 } // namespace display | 217 } // namespace display |
212 | 218 |
213 #endif // UI_DISPLAY_DISPLAY_H_ | 219 #endif // UI_DISPLAY_DISPLAY_H_ |
OLD | NEW |