| 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 #include "ui/display/manager/managed_display_info.h" | 5 #include "ui/display/manager/managed_display_info.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 active_rotation_source_(Display::ROTATION_SOURCE_UNKNOWN), | 305 active_rotation_source_(Display::ROTATION_SOURCE_UNKNOWN), |
| 306 touch_support_(Display::TOUCH_SUPPORT_UNKNOWN), | 306 touch_support_(Display::TOUCH_SUPPORT_UNKNOWN), |
| 307 has_touch_calibration_data_(false), | 307 has_touch_calibration_data_(false), |
| 308 device_scale_factor_(1.0f), | 308 device_scale_factor_(1.0f), |
| 309 device_dpi_(kDpi96), | 309 device_dpi_(kDpi96), |
| 310 overscan_insets_in_dip_(0, 0, 0, 0), | 310 overscan_insets_in_dip_(0, 0, 0, 0), |
| 311 configured_ui_scale_(1.0f), | 311 configured_ui_scale_(1.0f), |
| 312 native_(false), | 312 native_(false), |
| 313 is_aspect_preserving_scaling_(false), | 313 is_aspect_preserving_scaling_(false), |
| 314 clear_overscan_insets_(false), | 314 clear_overscan_insets_(false), |
| 315 color_profile_(ui::COLOR_PROFILE_STANDARD) {} | 315 color_profile_(COLOR_PROFILE_STANDARD) {} |
| 316 | 316 |
| 317 ManagedDisplayInfo::ManagedDisplayInfo(int64_t id, | 317 ManagedDisplayInfo::ManagedDisplayInfo(int64_t id, |
| 318 const std::string& name, | 318 const std::string& name, |
| 319 bool has_overscan) | 319 bool has_overscan) |
| 320 : id_(id), | 320 : id_(id), |
| 321 name_(name), | 321 name_(name), |
| 322 has_overscan_(has_overscan), | 322 has_overscan_(has_overscan), |
| 323 active_rotation_source_(Display::ROTATION_SOURCE_UNKNOWN), | 323 active_rotation_source_(Display::ROTATION_SOURCE_UNKNOWN), |
| 324 touch_support_(Display::TOUCH_SUPPORT_UNKNOWN), | 324 touch_support_(Display::TOUCH_SUPPORT_UNKNOWN), |
| 325 has_touch_calibration_data_(false), | 325 has_touch_calibration_data_(false), |
| 326 device_scale_factor_(1.0f), | 326 device_scale_factor_(1.0f), |
| 327 device_dpi_(kDpi96), | 327 device_dpi_(kDpi96), |
| 328 overscan_insets_in_dip_(0, 0, 0, 0), | 328 overscan_insets_in_dip_(0, 0, 0, 0), |
| 329 configured_ui_scale_(1.0f), | 329 configured_ui_scale_(1.0f), |
| 330 native_(false), | 330 native_(false), |
| 331 is_aspect_preserving_scaling_(false), | 331 is_aspect_preserving_scaling_(false), |
| 332 clear_overscan_insets_(false), | 332 clear_overscan_insets_(false), |
| 333 color_profile_(ui::COLOR_PROFILE_STANDARD) {} | 333 color_profile_(COLOR_PROFILE_STANDARD) {} |
| 334 | 334 |
| 335 ManagedDisplayInfo::ManagedDisplayInfo(const ManagedDisplayInfo& other) = | 335 ManagedDisplayInfo::ManagedDisplayInfo(const ManagedDisplayInfo& other) = |
| 336 default; | 336 default; |
| 337 | 337 |
| 338 ManagedDisplayInfo::~ManagedDisplayInfo() {} | 338 ManagedDisplayInfo::~ManagedDisplayInfo() {} |
| 339 | 339 |
| 340 void ManagedDisplayInfo::SetRotation(Display::Rotation rotation, | 340 void ManagedDisplayInfo::SetRotation(Display::Rotation rotation, |
| 341 Display::RotationSource source) { | 341 Display::RotationSource source) { |
| 342 rotations_[source] = rotation; | 342 rotations_[source] = rotation; |
| 343 rotations_[Display::ROTATION_SOURCE_ACTIVE] = rotation; | 343 rotations_[Display::ROTATION_SOURCE_ACTIVE] = rotation; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 if (!display_modes_str.empty()) | 493 if (!display_modes_str.empty()) |
| 494 display_modes_str += ","; | 494 display_modes_str += ","; |
| 495 base::StringAppendF( | 495 base::StringAppendF( |
| 496 &display_modes_str, "(%dx%d@%g%c%s %g/%g)", m->size().width(), | 496 &display_modes_str, "(%dx%d@%g%c%s %g/%g)", m->size().width(), |
| 497 m->size().height(), m->refresh_rate(), m->is_interlaced() ? 'I' : 'P', | 497 m->size().height(), m->refresh_rate(), m->is_interlaced() ? 'I' : 'P', |
| 498 m->native() ? "(N)" : "", m->ui_scale(), m->device_scale_factor()); | 498 m->native() ? "(N)" : "", m->ui_scale(), m->device_scale_factor()); |
| 499 } | 499 } |
| 500 return ToString() + ", display_modes==" + display_modes_str; | 500 return ToString() + ", display_modes==" + display_modes_str; |
| 501 } | 501 } |
| 502 | 502 |
| 503 void ManagedDisplayInfo::SetColorProfile(ui::ColorCalibrationProfile profile) { | 503 void ManagedDisplayInfo::SetColorProfile(ColorCalibrationProfile profile) { |
| 504 if (IsColorProfileAvailable(profile)) | 504 if (IsColorProfileAvailable(profile)) |
| 505 color_profile_ = profile; | 505 color_profile_ = profile; |
| 506 } | 506 } |
| 507 | 507 |
| 508 bool ManagedDisplayInfo::IsColorProfileAvailable( | 508 bool ManagedDisplayInfo::IsColorProfileAvailable( |
| 509 ui::ColorCalibrationProfile profile) const { | 509 ColorCalibrationProfile profile) const { |
| 510 return std::find(available_color_profiles_.begin(), | 510 return std::find(available_color_profiles_.begin(), |
| 511 available_color_profiles_.end(), | 511 available_color_profiles_.end(), |
| 512 profile) != available_color_profiles_.end(); | 512 profile) != available_color_profiles_.end(); |
| 513 } | 513 } |
| 514 | 514 |
| 515 bool ManagedDisplayInfo::Use125DSFForUIScaling() const { | 515 bool ManagedDisplayInfo::Use125DSFForUIScaling() const { |
| 516 return use_125_dsf_for_ui_scaling && Display::IsInternalDisplayId(id_); | 516 return use_125_dsf_for_ui_scaling && Display::IsInternalDisplayId(id_); |
| 517 } | 517 } |
| 518 | 518 |
| 519 void ManagedDisplayInfo::AddInputDevice(int id) { | 519 void ManagedDisplayInfo::AddInputDevice(int id) { |
| 520 input_devices_.push_back(id); | 520 input_devices_.push_back(id); |
| 521 } | 521 } |
| 522 | 522 |
| 523 void ManagedDisplayInfo::ClearInputDevices() { | 523 void ManagedDisplayInfo::ClearInputDevices() { |
| 524 input_devices_.clear(); | 524 input_devices_.clear(); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void ResetDisplayIdForTest() { | 527 void ResetDisplayIdForTest() { |
| 528 synthesized_display_id = kSynthesizedDisplayIdStart; | 528 synthesized_display_id = kSynthesizedDisplayIdStart; |
| 529 } | 529 } |
| 530 | 530 |
| 531 void ManagedDisplayInfo::SetTouchCalibrationData( | 531 void ManagedDisplayInfo::SetTouchCalibrationData( |
| 532 const TouchCalibrationData& touch_calibration_data) { | 532 const TouchCalibrationData& touch_calibration_data) { |
| 533 has_touch_calibration_data_ = true; | 533 has_touch_calibration_data_ = true; |
| 534 touch_calibration_data_ = touch_calibration_data; | 534 touch_calibration_data_ = touch_calibration_data; |
| 535 } | 535 } |
| 536 | 536 |
| 537 } // namespace display | 537 } // namespace display |
| OLD | NEW |