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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 color_profile_ = native_info.color_profile(); | 386 color_profile_ = native_info.color_profile(); |
387 } | 387 } |
388 } | 388 } |
389 | 389 |
390 void ManagedDisplayInfo::SetBounds(const gfx::Rect& new_bounds_in_native) { | 390 void ManagedDisplayInfo::SetBounds(const gfx::Rect& new_bounds_in_native) { |
391 bounds_in_native_ = new_bounds_in_native; | 391 bounds_in_native_ = new_bounds_in_native; |
392 size_in_pixel_ = new_bounds_in_native.size(); | 392 size_in_pixel_ = new_bounds_in_native.size(); |
393 UpdateDisplaySize(); | 393 UpdateDisplaySize(); |
394 } | 394 } |
395 | 395 |
396 float ManagedDisplayInfo::GetDensityRatio() const { | |
397 if (Use125DSFForUIScaling() && device_scale_factor_ == 1.25f) | |
398 return 1.0f; | |
399 return device_scale_factor_; | |
400 } | |
401 | |
396 float ManagedDisplayInfo::GetEffectiveDeviceScaleFactor() const { | 402 float ManagedDisplayInfo::GetEffectiveDeviceScaleFactor() const { |
397 if (Use125DSFForUIScaling() && device_scale_factor_ == 1.25f) | 403 if (Use125DSFForUIScaling() && device_scale_factor_ == 1.25f) |
398 return (configured_ui_scale_ == 0.8f) ? 1.25f : 1.0f; | 404 return (configured_ui_scale_ == 0.8f) ? 1.25f : 1.0f; |
399 if (device_scale_factor_ == configured_ui_scale_) | 405 if (device_scale_factor_ == configured_ui_scale_) |
400 return 1.0f; | 406 return 1.0f; |
401 return device_scale_factor_; | 407 return device_scale_factor_; |
402 } | 408 } |
403 | 409 |
404 float ManagedDisplayInfo::GetEffectiveUIScale() const { | 410 float ManagedDisplayInfo::GetEffectiveUIScale() const { |
405 if (Use125DSFForUIScaling() && device_scale_factor_ == 1.25f) | 411 if (Use125DSFForUIScaling() && device_scale_factor_ == 1.25f) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 if (IsColorProfileAvailable(profile)) | 503 if (IsColorProfileAvailable(profile)) |
498 color_profile_ = profile; | 504 color_profile_ = profile; |
499 } | 505 } |
500 | 506 |
501 bool ManagedDisplayInfo::IsColorProfileAvailable( | 507 bool ManagedDisplayInfo::IsColorProfileAvailable( |
502 ColorCalibrationProfile profile) const { | 508 ColorCalibrationProfile profile) const { |
503 return base::ContainsValue(available_color_profiles_, profile); | 509 return base::ContainsValue(available_color_profiles_, profile); |
504 } | 510 } |
505 | 511 |
506 bool ManagedDisplayInfo::Use125DSFForUIScaling() const { | 512 bool ManagedDisplayInfo::Use125DSFForUIScaling() const { |
507 return Display::IsInternalDisplayId(id_); | 513 return id_ != kInvalidDisplayId && Display::IsInternalDisplayId(id_); |
oshima
2017/06/23 23:57:14
why this is necessary?
Dominik Laskowski
2017/06/23 23:59:13
So GetDensityRatio does not DCHECK on a default-co
| |
508 } | 514 } |
509 | 515 |
510 void ManagedDisplayInfo::AddInputDevice(int id) { | 516 void ManagedDisplayInfo::AddInputDevice(int id) { |
511 input_devices_.push_back(id); | 517 input_devices_.push_back(id); |
512 } | 518 } |
513 | 519 |
514 void ManagedDisplayInfo::ClearInputDevices() { | 520 void ManagedDisplayInfo::ClearInputDevices() { |
515 input_devices_.clear(); | 521 input_devices_.clear(); |
516 } | 522 } |
517 | 523 |
518 void ResetDisplayIdForTest() { | 524 void ResetDisplayIdForTest() { |
519 synthesized_display_id = kSynthesizedDisplayIdStart; | 525 synthesized_display_id = kSynthesizedDisplayIdStart; |
520 } | 526 } |
521 | 527 |
522 void ManagedDisplayInfo::SetTouchCalibrationData( | 528 void ManagedDisplayInfo::SetTouchCalibrationData( |
523 const TouchCalibrationData& touch_calibration_data) { | 529 const TouchCalibrationData& touch_calibration_data) { |
524 has_touch_calibration_data_ = true; | 530 has_touch_calibration_data_ = true; |
525 touch_calibration_data_ = touch_calibration_data; | 531 touch_calibration_data_ = touch_calibration_data; |
526 } | 532 } |
527 | 533 |
528 } // namespace display | 534 } // namespace display |
OLD | NEW |