Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: ash/display/display_manager.cc

Issue 455443002: Remember the configured device scale factor for external displays. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/display/display_manager.h ('k') | chrome/browser/chromeos/display/display_preferences.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ash/display/display_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 #endif 523 #endif
524 return resolution_changed; 524 return resolution_changed;
525 } 525 }
526 526
527 void DisplayManager::RegisterDisplayProperty( 527 void DisplayManager::RegisterDisplayProperty(
528 int64 display_id, 528 int64 display_id,
529 gfx::Display::Rotation rotation, 529 gfx::Display::Rotation rotation,
530 float ui_scale, 530 float ui_scale,
531 const gfx::Insets* overscan_insets, 531 const gfx::Insets* overscan_insets,
532 const gfx::Size& resolution_in_pixels, 532 const gfx::Size& resolution_in_pixels,
533 float device_scale_factor,
533 ui::ColorCalibrationProfile color_profile) { 534 ui::ColorCalibrationProfile color_profile) {
534 if (display_info_.find(display_id) == display_info_.end()) 535 if (display_info_.find(display_id) == display_info_.end())
535 display_info_[display_id] = DisplayInfo(display_id, std::string(), false); 536 display_info_[display_id] = DisplayInfo(display_id, std::string(), false);
536 537
537 display_info_[display_id].set_rotation(rotation); 538 display_info_[display_id].set_rotation(rotation);
538 display_info_[display_id].SetColorProfile(color_profile); 539 display_info_[display_id].SetColorProfile(color_profile);
539 // Just in case the preference file was corrupted. 540 // Just in case the preference file was corrupted.
540 // TODO(mukai): register |display_modes_| here as well, so the lookup for the 541 // TODO(mukai): register |display_modes_| here as well, so the lookup for the
541 // default mode in GetActiveModeForDisplayId() gets much simpler. 542 // default mode in GetActiveModeForDisplayId() gets much simpler.
542 if (0.5f <= ui_scale && ui_scale <= 2.0f) 543 if (0.5f <= ui_scale && ui_scale <= 2.0f)
543 display_info_[display_id].set_configured_ui_scale(ui_scale); 544 display_info_[display_id].set_configured_ui_scale(ui_scale);
544 if (overscan_insets) 545 if (overscan_insets)
545 display_info_[display_id].SetOverscanInsets(*overscan_insets); 546 display_info_[display_id].SetOverscanInsets(*overscan_insets);
546 if (!resolution_in_pixels.IsEmpty()) { 547 if (!resolution_in_pixels.IsEmpty()) {
548 DCHECK(!IsInternalDisplayId(display_id));
547 // Default refresh rate, until OnNativeDisplaysChanged() updates us with the 549 // Default refresh rate, until OnNativeDisplaysChanged() updates us with the
548 // actual display info, is 60 Hz. 550 // actual display info, is 60 Hz.
549 display_modes_[display_id] = 551 DisplayMode mode(resolution_in_pixels, 60.0f, false, false);
550 DisplayMode(resolution_in_pixels, 60.0f, false, false); 552 mode.device_scale_factor = device_scale_factor;
553 display_modes_[display_id] = mode;
551 } 554 }
552 } 555 }
553 556
554 DisplayMode DisplayManager::GetActiveModeForDisplayId(int64 display_id) const { 557 DisplayMode DisplayManager::GetActiveModeForDisplayId(int64 display_id) const {
555 DisplayMode selected_mode; 558 DisplayMode selected_mode;
556 if (GetSelectedModeForDisplayId(display_id, &selected_mode)) 559 if (GetSelectedModeForDisplayId(display_id, &selected_mode))
557 return selected_mode; 560 return selected_mode;
558 561
559 // If 'selected' mode is empty, it should return the default mode. This means 562 // If 'selected' mode is empty, it should return the default mode. This means
560 // the native mode for the external display. Unfortunately this is not true 563 // the native mode for the external display. Unfortunately this is not true
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 new_secondary_origin.Offset(-secondary_bounds.width(), offset); 1231 new_secondary_origin.Offset(-secondary_bounds.width(), offset);
1229 break; 1232 break;
1230 } 1233 }
1231 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); 1234 gfx::Insets insets = secondary_display->GetWorkAreaInsets();
1232 secondary_display->set_bounds( 1235 secondary_display->set_bounds(
1233 gfx::Rect(new_secondary_origin, secondary_bounds.size())); 1236 gfx::Rect(new_secondary_origin, secondary_bounds.size()));
1234 secondary_display->UpdateWorkAreaFromInsets(insets); 1237 secondary_display->UpdateWorkAreaFromInsets(insets);
1235 } 1238 }
1236 1239
1237 } // namespace ash 1240 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.h ('k') | chrome/browser/chromeos/display/display_preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698