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

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

Issue 12505005: Store rotation/ui scale to local state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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) 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 void DisplayInfo::CopyFromNative(const DisplayInfo& native_info) { 132 void DisplayInfo::CopyFromNative(const DisplayInfo& native_info) {
133 DCHECK(id_ == native_info.id_); 133 DCHECK(id_ == native_info.id_);
134 name_ = native_info.name_; 134 name_ = native_info.name_;
135 has_overscan_ = native_info.has_overscan_; 135 has_overscan_ = native_info.has_overscan_;
136 136
137 DCHECK(!native_info.bounds_in_pixel_.IsEmpty()); 137 DCHECK(!native_info.bounds_in_pixel_.IsEmpty());
138 bounds_in_pixel_ = native_info.bounds_in_pixel_; 138 bounds_in_pixel_ = native_info.bounds_in_pixel_;
139 size_in_pixel_ = native_info.size_in_pixel_; 139 size_in_pixel_ = native_info.size_in_pixel_;
140 device_scale_factor_ = native_info.device_scale_factor_; 140 device_scale_factor_ = native_info.device_scale_factor_;
141 rotation_ = native_info.rotation_; 141
142 ui_scale_ = native_info.ui_scale_; 142 // Rotation_ and ui_scale_ are given by preference, or unit
143 // tests. Don't copy if this native_info came from
144 // DisplayChangeObserverX11.
145 if (native_info.ui_scale() >= 1.0f) {
146 rotation_ = native_info.rotation_;
147 ui_scale_ = native_info.ui_scale_;
148 }
149 // It makes little sense to scale beyond the original
150 // resolution. This guard is to protect applying
151 // ui_scale to an external display whose DPI has changed
152 // from 2.0 to 1.0 for some reason.
153 if (ui_scale_ > device_scale_factor_)
154 ui_scale_ = 1.0f;
155
143 // Don't copy insets as it may be given by preference. |rotation_| 156 // Don't copy insets as it may be given by preference. |rotation_|
144 // is treated as a native so that it can be specified in 157 // is treated as a native so that it can be specified in
145 // |CreateFromSpec|. 158 // |CreateFromSpec|.
146 } 159 }
147 160
148 void DisplayInfo::SetBounds(const gfx::Rect& new_bounds_in_pixel) { 161 void DisplayInfo::SetBounds(const gfx::Rect& new_bounds_in_pixel) {
149 bounds_in_pixel_ = new_bounds_in_pixel; 162 bounds_in_pixel_ = new_bounds_in_pixel;
150 size_in_pixel_ = new_bounds_in_pixel.size(); 163 size_in_pixel_ = new_bounds_in_pixel.size();
151 UpdateDisplaySize(); 164 UpdateDisplaySize();
152 } 165 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 bounds_in_pixel_.ToString().c_str(), 212 bounds_in_pixel_.ToString().c_str(),
200 size_in_pixel_.ToString().c_str(), 213 size_in_pixel_.ToString().c_str(),
201 device_scale_factor_, 214 device_scale_factor_,
202 overscan_insets_in_dip_.ToString().c_str(), 215 overscan_insets_in_dip_.ToString().c_str(),
203 rotation_degree, 216 rotation_degree,
204 ui_scale_); 217 ui_scale_);
205 } 218 }
206 219
207 } // namespace internal 220 } // namespace internal
208 } // namespace ash 221 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698