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 <stdio.h> | 5 #include <stdio.h> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/display/display_info.h" | 9 #include "ash/display/display_info.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 } | 259 } |
260 | 260 |
261 DisplayInfo::~DisplayInfo() { | 261 DisplayInfo::~DisplayInfo() { |
262 } | 262 } |
263 | 263 |
264 void DisplayInfo::Copy(const DisplayInfo& native_info) { | 264 void DisplayInfo::Copy(const DisplayInfo& native_info) { |
265 DCHECK(id_ == native_info.id_); | 265 DCHECK(id_ == native_info.id_); |
266 name_ = native_info.name_; | 266 name_ = native_info.name_; |
267 has_overscan_ = native_info.has_overscan_; | 267 has_overscan_ = native_info.has_overscan_; |
268 | 268 |
269 touch_support_ = native_info.touch_support_; | |
270 touch_device_id_ = native_info.touch_device_id_; | |
271 device_scale_factor_ = native_info.device_scale_factor_; | |
269 DCHECK(!native_info.bounds_in_native_.IsEmpty()); | 272 DCHECK(!native_info.bounds_in_native_.IsEmpty()); |
270 bounds_in_native_ = native_info.bounds_in_native_; | 273 bounds_in_native_ = native_info.bounds_in_native_; |
271 size_in_pixel_ = native_info.size_in_pixel_; | 274 size_in_pixel_ = native_info.size_in_pixel_; |
272 device_scale_factor_ = native_info.device_scale_factor_; | 275 is_aspect_preserving_scaling_ = native_info.is_aspect_preserving_scaling_; |
273 display_modes_ = native_info.display_modes_; | 276 display_modes_ = native_info.display_modes_; |
274 touch_support_ = native_info.touch_support_; | 277 available_color_profiles_ = native_info.available_color_profiles_; |
pkotwicz
2015/01/29 20:37:59
I reordered these to match the order in the .h fil
| |
275 touch_device_id_ = native_info.touch_device_id_; | |
276 | 278 |
277 // Rotation, ui_scale, color_profile and overscan are given by preference, | 279 // Rotation, ui_scale, color_profile and overscan are given by preference, |
278 // or unit tests. Don't copy if this native_info came from | 280 // or unit tests. Don't copy if this native_info came from |
279 // DisplayChangeObserver. | 281 // DisplayChangeObserver. |
280 if (!native_info.native()) { | 282 if (!native_info.native()) { |
281 // Update the overscan_insets_in_dip_ either if the inset should be | 283 // Update the overscan_insets_in_dip_ either if the inset should be |
282 // cleared, or has non empty insts. | 284 // cleared, or has non empty insts. |
283 if (native_info.clear_overscan_insets()) | 285 if (native_info.clear_overscan_insets()) |
284 overscan_insets_in_dip_.Set(0, 0, 0, 0); | 286 overscan_insets_in_dip_.Set(0, 0, 0, 0); |
285 else if (!native_info.overscan_insets_in_dip_.empty()) | 287 else if (!native_info.overscan_insets_in_dip_.empty()) |
286 overscan_insets_in_dip_ = native_info.overscan_insets_in_dip_; | 288 overscan_insets_in_dip_ = native_info.overscan_insets_in_dip_; |
287 | 289 |
288 rotation_ = native_info.rotation_; | 290 rotation_ = native_info.rotation_; |
289 configured_ui_scale_ = native_info.configured_ui_scale_; | 291 configured_ui_scale_ = native_info.configured_ui_scale_; |
290 color_profile_ = native_info.color_profile(); | 292 color_profile_ = native_info.color_profile(); |
291 } | 293 } |
292 | |
293 available_color_profiles_ = native_info.available_color_profiles(); | |
294 | |
295 // Don't copy insets as it may be given by preference. |rotation_| | |
296 // is treated as a native so that it can be specified in | |
297 // |CreateFromSpec|. | |
298 } | 294 } |
299 | 295 |
300 void DisplayInfo::SetBounds(const gfx::Rect& new_bounds_in_native) { | 296 void DisplayInfo::SetBounds(const gfx::Rect& new_bounds_in_native) { |
301 bounds_in_native_ = new_bounds_in_native; | 297 bounds_in_native_ = new_bounds_in_native; |
302 size_in_pixel_ = new_bounds_in_native.size(); | 298 size_in_pixel_ = new_bounds_in_native.size(); |
303 UpdateDisplaySize(); | 299 UpdateDisplaySize(); |
304 } | 300 } |
305 | 301 |
306 float DisplayInfo::GetEffectiveDeviceScaleFactor() const { | 302 float DisplayInfo::GetEffectiveDeviceScaleFactor() const { |
307 if (Use125DSFRorUIScaling() && device_scale_factor_ == 1.25f) | 303 if (Use125DSFRorUIScaling() && device_scale_factor_ == 1.25f) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 return std::find(available_color_profiles_.begin(), | 405 return std::find(available_color_profiles_.begin(), |
410 available_color_profiles_.end(), | 406 available_color_profiles_.end(), |
411 profile) != available_color_profiles_.end(); | 407 profile) != available_color_profiles_.end(); |
412 } | 408 } |
413 | 409 |
414 bool DisplayInfo::Use125DSFRorUIScaling() const { | 410 bool DisplayInfo::Use125DSFRorUIScaling() const { |
415 return use_125_dsf_for_ui_scaling && id_ == gfx::Display::InternalDisplayId(); | 411 return use_125_dsf_for_ui_scaling && id_ == gfx::Display::InternalDisplayId(); |
416 } | 412 } |
417 | 413 |
418 } // namespace ash | 414 } // namespace ash |
OLD | NEW |