Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_MANAGER_MANAGED_DISPLAY_INFO_H_ | 5 #ifndef UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ |
| 6 #define UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ | 6 #define UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <array> | |
| 10 #include <map> | 11 #include <map> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "ui/display/display.h" | 17 #include "ui/display/display.h" |
| 17 #include "ui/display/display_export.h" | 18 #include "ui/display/display_export.h" |
| 18 #include "ui/display/types/display_constants.h" | 19 #include "ui/display/types/display_constants.h" |
| 19 #include "ui/gfx/geometry/insets.h" | 20 #include "ui/gfx/geometry/insets.h" |
| 20 #include "ui/gfx/geometry/rect.h" | 21 #include "ui/gfx/geometry/rect.h" |
| 21 | 22 |
| 22 namespace display { | 23 namespace display { |
| 23 | 24 |
| 25 // A struct that represents all the data required for touch calibration for the | |
| 26 // display. | |
| 27 struct DISPLAY_EXPORT TouchCalibrationData { | |
| 28 // CalibrationPointPair.first -> display point | |
| 29 // CalibrationPointPair.second -> touch point | |
| 30 using CalibrationPointPair = std::pair<gfx::Point, gfx::Point>; | |
| 31 using CalibrationPoints = std::array<CalibrationPointPair, 4>; | |
|
oshima
2016/11/23 21:52:42
how about CalibrationPointPairQuad ?
malaykeshav
2016/11/23 22:11:27
Done
| |
| 32 TouchCalibrationData(); | |
| 33 TouchCalibrationData(const CalibrationPoints& point_pairs, | |
| 34 const gfx::Size& bounds); | |
| 35 TouchCalibrationData(const TouchCalibrationData& calibration_data); | |
| 36 | |
| 37 // Calibration point pairs used during calibration. Each point pair contains a | |
| 38 // display point and the corresponding touch point. | |
| 39 CalibrationPoints point_pairs; | |
| 40 | |
| 41 // Bounds of the touch display when the calibration was performed. | |
| 42 gfx::Size bounds; | |
| 43 }; | |
| 44 | |
| 24 // A class that represents the display's mode info. | 45 // A class that represents the display's mode info. |
| 25 class DISPLAY_EXPORT ManagedDisplayMode | 46 class DISPLAY_EXPORT ManagedDisplayMode |
| 26 : public base::RefCounted<ManagedDisplayMode> { | 47 : public base::RefCounted<ManagedDisplayMode> { |
| 27 public: | 48 public: |
| 28 ManagedDisplayMode(); | 49 ManagedDisplayMode(); |
| 29 | 50 |
| 30 explicit ManagedDisplayMode(const gfx::Size& size); | 51 explicit ManagedDisplayMode(const gfx::Size& size); |
| 31 | 52 |
| 32 ManagedDisplayMode(const gfx::Size& size, | 53 ManagedDisplayMode(const gfx::Size& size, |
| 33 float refresh_rate, | 54 float refresh_rate, |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 void set_clear_overscan_insets(bool clear) { clear_overscan_insets_ = clear; } | 257 void set_clear_overscan_insets(bool clear) { clear_overscan_insets_ = clear; } |
| 237 | 258 |
| 238 void set_native(bool native) { native_ = native; } | 259 void set_native(bool native) { native_ = native; } |
| 239 bool native() const { return native_; } | 260 bool native() const { return native_; } |
| 240 | 261 |
| 241 const ManagedDisplayModeList& display_modes() const { return display_modes_; } | 262 const ManagedDisplayModeList& display_modes() const { return display_modes_; } |
| 242 // Sets the display mode list. The mode list will be sorted for the | 263 // Sets the display mode list. The mode list will be sorted for the |
| 243 // display. | 264 // display. |
| 244 void SetManagedDisplayModes(const ManagedDisplayModeList& display_modes); | 265 void SetManagedDisplayModes(const ManagedDisplayModeList& display_modes); |
| 245 | 266 |
| 267 | |
| 268 // Sets/Gets the touch calibration data for the display. | |
|
oshima
2016/11/23 21:52:42
indent
malaykeshav
2016/11/23 22:11:27
Done
| |
| 269 void SetTouchCalibrationData(const TouchCalibrationData& calibration_data); | |
| 270 TouchCalibrationData | |
|
oshima
2016/11/23 21:52:42
const &
malaykeshav
2016/11/23 22:11:27
Done
| |
| 271 GetTouchCalibrationData() const { return touch_calibration_data_; } | |
| 272 bool has_touch_calibration_data() const | |
| 273 { return has_touch_calibration_data_; } | |
| 274 void clear_touch_calibration_data() { has_touch_calibration_data_ = false; } | |
| 275 | |
| 246 // Returns the native mode size. If a native mode is not present, return an | 276 // Returns the native mode size. If a native mode is not present, return an |
| 247 // empty size. | 277 // empty size. |
| 248 gfx::Size GetNativeModeSize() const; | 278 gfx::Size GetNativeModeSize() const; |
| 249 | 279 |
| 250 ui::ColorCalibrationProfile color_profile() const { return color_profile_; } | 280 ui::ColorCalibrationProfile color_profile() const { return color_profile_; } |
| 251 | 281 |
| 252 // Sets the color profile. It will ignore if the specified |profile| is not in | 282 // Sets the color profile. It will ignore if the specified |profile| is not in |
| 253 // |available_color_profiles_|. | 283 // |available_color_profiles_|. |
| 254 void SetColorProfile(ui::ColorCalibrationProfile profile); | 284 void SetColorProfile(ui::ColorCalibrationProfile profile); |
| 255 | 285 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 // SetUse125DSFForUIScaling(true) is called and this is the internal display. | 325 // SetUse125DSFForUIScaling(true) is called and this is the internal display. |
| 296 bool Use125DSFForUIScaling() const; | 326 bool Use125DSFForUIScaling() const; |
| 297 | 327 |
| 298 int64_t id_; | 328 int64_t id_; |
| 299 std::string name_; | 329 std::string name_; |
| 300 base::FilePath sys_path_; | 330 base::FilePath sys_path_; |
| 301 bool has_overscan_; | 331 bool has_overscan_; |
| 302 std::map<Display::RotationSource, Display::Rotation> rotations_; | 332 std::map<Display::RotationSource, Display::Rotation> rotations_; |
| 303 Display::RotationSource active_rotation_source_; | 333 Display::RotationSource active_rotation_source_; |
| 304 Display::TouchSupport touch_support_; | 334 Display::TouchSupport touch_support_; |
| 335 bool has_touch_calibration_data_; | |
| 305 | 336 |
| 306 // The set of input devices associated with this display. | 337 // The set of input devices associated with this display. |
| 307 std::vector<int> input_devices_; | 338 std::vector<int> input_devices_; |
| 308 | 339 |
| 309 // This specifies the device's pixel density. (For example, a | 340 // This specifies the device's pixel density. (For example, a |
| 310 // display whose DPI is higher than the threshold is considered to have | 341 // display whose DPI is higher than the threshold is considered to have |
| 311 // device_scale_factor = 2.0 on Chrome OS). This is used by the | 342 // device_scale_factor = 2.0 on Chrome OS). This is used by the |
| 312 // grapics layer to choose and draw appropriate images and scale | 343 // grapics layer to choose and draw appropriate images and scale |
| 313 // layers properly. | 344 // layers properly. |
| 314 float device_scale_factor_; | 345 float device_scale_factor_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 | 378 |
| 348 // The current profile of the color calibration. | 379 // The current profile of the color calibration. |
| 349 ui::ColorCalibrationProfile color_profile_; | 380 ui::ColorCalibrationProfile color_profile_; |
| 350 | 381 |
| 351 // The list of available variations for the color calibration. | 382 // The list of available variations for the color calibration. |
| 352 std::vector<ui::ColorCalibrationProfile> available_color_profiles_; | 383 std::vector<ui::ColorCalibrationProfile> available_color_profiles_; |
| 353 | 384 |
| 354 // Maximum cursor size. | 385 // Maximum cursor size. |
| 355 gfx::Size maximum_cursor_size_; | 386 gfx::Size maximum_cursor_size_; |
| 356 | 387 |
| 388 // Information associated to touch calibration for the display. | |
| 389 TouchCalibrationData touch_calibration_data_; | |
| 390 | |
| 357 // If you add a new member, you need to update Copy(). | 391 // If you add a new member, you need to update Copy(). |
| 358 }; | 392 }; |
| 359 | 393 |
| 360 // Resets the synthesized display id for testing. This | 394 // Resets the synthesized display id for testing. This |
| 361 // is necessary to avoid overflowing the output index. | 395 // is necessary to avoid overflowing the output index. |
| 362 void DISPLAY_EXPORT ResetDisplayIdForTest(); | 396 void DISPLAY_EXPORT ResetDisplayIdForTest(); |
| 363 | 397 |
| 364 } // namespace display | 398 } // namespace display |
| 365 | 399 |
| 366 #endif // UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ | 400 #endif // UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ |
| OLD | NEW |