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

Side by Side Diff: chromeos/display/output_configurator.cc

Issue 138903025: Read compositor VSync information from platform, when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 041e3518 Cleaned up. Created 6 years, 11 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
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 "chromeos/display/output_configurator.h" 5 #include "chromeos/display/output_configurator.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #include <X11/extensions/Xrandr.h> 8 #include <X11/extensions/Xrandr.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 10
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } 659 }
660 660
661 void OutputConfigurator::UpdateCachedOutputs() { 661 void OutputConfigurator::UpdateCachedOutputs() {
662 cached_outputs_ = delegate_->GetOutputs(); 662 cached_outputs_ = delegate_->GetOutputs();
663 663
664 // Set |selected_mode| fields. 664 // Set |selected_mode| fields.
665 for (size_t i = 0; i < cached_outputs_.size(); ++i) { 665 for (size_t i = 0; i < cached_outputs_.size(); ++i) {
666 OutputSnapshot* output = &cached_outputs_[i]; 666 OutputSnapshot* output = &cached_outputs_[i];
667 if (output->has_display_id) { 667 if (output->has_display_id) {
668 int width = 0, height = 0; 668 int width = 0, height = 0;
669 float refresh_rate;
669 if (state_controller_ && 670 if (state_controller_ &&
670 state_controller_->GetResolutionForDisplayId( 671 state_controller_->GetResolutionForDisplayId(
671 output->display_id, &width, &height)) { 672 output->display_id, &width, &height, &refresh_rate)) {
672 output->selected_mode = 673 output->selected_mode =
673 FindOutputModeMatchingSize(*output, width, height); 674 FindOutputModeMatchingSize(*output, width, height);
674 } 675 }
675 } 676 }
676 // Fall back to native mode. 677 // Fall back to native mode.
677 if (output->selected_mode == None) 678 if (output->selected_mode == None)
678 output->selected_mode = output->native_mode; 679 output->selected_mode = output->native_mode;
679 } 680 }
680 681
681 // Set |mirror_mode| fields. 682 // Set |mirror_mode| fields.
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 float width_ratio = static_cast<float>(mirror_mode_info->width) / 1146 float width_ratio = static_cast<float>(mirror_mode_info->width) /
1146 static_cast<float>(native_mode_info->width); 1147 static_cast<float>(native_mode_info->width);
1147 float height_ratio = static_cast<float>(mirror_mode_info->height) / 1148 float height_ratio = static_cast<float>(mirror_mode_info->height) /
1148 static_cast<float>(native_mode_info->height); 1149 static_cast<float>(native_mode_info->height);
1149 1150
1150 area_ratio = width_ratio * height_ratio; 1151 area_ratio = width_ratio * height_ratio;
1151 return area_ratio; 1152 return area_ratio;
1152 } 1153 }
1153 1154
1154 } // namespace chromeos 1155 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698