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

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

Issue 191223007: Move touch CTM from X into Chrome (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: restructuring Created 6 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
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 DVLOG(1) << "DisplayInfoFromSpec info=" << display_info.ToString() 163 DVLOG(1) << "DisplayInfoFromSpec info=" << display_info.ToString()
164 << ", spec=" << spec; 164 << ", spec=" << spec;
165 return display_info; 165 return display_info;
166 } 166 }
167 167
168 DisplayInfo::DisplayInfo() 168 DisplayInfo::DisplayInfo()
169 : id_(gfx::Display::kInvalidDisplayID), 169 : id_(gfx::Display::kInvalidDisplayID),
170 has_overscan_(false), 170 has_overscan_(false),
171 rotation_(gfx::Display::ROTATE_0), 171 rotation_(gfx::Display::ROTATE_0),
172 touch_support_(gfx::Display::TOUCH_SUPPORT_UNKNOWN), 172 touch_support_(gfx::Display::TOUCH_SUPPORT_UNKNOWN),
173 touch_device_id_(0),
173 device_scale_factor_(1.0f), 174 device_scale_factor_(1.0f),
174 overscan_insets_in_dip_(0, 0, 0, 0), 175 overscan_insets_in_dip_(0, 0, 0, 0),
175 configured_ui_scale_(1.0f), 176 configured_ui_scale_(1.0f),
176 native_(false) { 177 native_(false) {
177 } 178 }
178 179
179 DisplayInfo::DisplayInfo(int64 id, 180 DisplayInfo::DisplayInfo(int64 id,
180 const std::string& name, 181 const std::string& name,
181 bool has_overscan) 182 bool has_overscan)
182 : id_(id), 183 : id_(id),
183 name_(name), 184 name_(name),
184 has_overscan_(has_overscan), 185 has_overscan_(has_overscan),
185 rotation_(gfx::Display::ROTATE_0), 186 rotation_(gfx::Display::ROTATE_0),
186 touch_support_(gfx::Display::TOUCH_SUPPORT_UNKNOWN), 187 touch_support_(gfx::Display::TOUCH_SUPPORT_UNKNOWN),
188 touch_device_id_(0),
187 device_scale_factor_(1.0f), 189 device_scale_factor_(1.0f),
188 overscan_insets_in_dip_(0, 0, 0, 0), 190 overscan_insets_in_dip_(0, 0, 0, 0),
189 configured_ui_scale_(1.0f), 191 configured_ui_scale_(1.0f),
190 native_(false) { 192 native_(false) {
191 } 193 }
192 194
193 DisplayInfo::~DisplayInfo() { 195 DisplayInfo::~DisplayInfo() {
194 } 196 }
195 197
196 void DisplayInfo::Copy(const DisplayInfo& native_info) { 198 void DisplayInfo::Copy(const DisplayInfo& native_info) {
197 DCHECK(id_ == native_info.id_); 199 DCHECK(id_ == native_info.id_);
198 name_ = native_info.name_; 200 name_ = native_info.name_;
199 has_overscan_ = native_info.has_overscan_; 201 has_overscan_ = native_info.has_overscan_;
200 202
201 DCHECK(!native_info.bounds_in_native_.IsEmpty()); 203 DCHECK(!native_info.bounds_in_native_.IsEmpty());
202 bounds_in_native_ = native_info.bounds_in_native_; 204 bounds_in_native_ = native_info.bounds_in_native_;
203 size_in_pixel_ = native_info.size_in_pixel_; 205 size_in_pixel_ = native_info.size_in_pixel_;
204 device_scale_factor_ = native_info.device_scale_factor_; 206 device_scale_factor_ = native_info.device_scale_factor_;
205 display_modes_ = native_info.display_modes_; 207 display_modes_ = native_info.display_modes_;
206 touch_support_ = native_info.touch_support_; 208 touch_support_ = native_info.touch_support_;
209 touch_device_id_ = native_info.touch_device_id_;
207 210
208 // Copy overscan_insets_in_dip_ if it's not empty. This is for test 211 // Copy overscan_insets_in_dip_ if it's not empty. This is for test
209 // cases which use "/o" annotation which sets the overscan inset 212 // cases which use "/o" annotation which sets the overscan inset
210 // to native, and that overscan has to be propagated. This does not 213 // to native, and that overscan has to be propagated. This does not
211 // happen on the real environment. 214 // happen on the real environment.
212 if (!native_info.overscan_insets_in_dip_.empty()) 215 if (!native_info.overscan_insets_in_dip_.empty())
213 overscan_insets_in_dip_ = native_info.overscan_insets_in_dip_; 216 overscan_insets_in_dip_ = native_info.overscan_insets_in_dip_;
214 217
215 // Rotation_ and ui_scale_ are given by preference, or unit 218 // Rotation_ and ui_scale_ are given by preference, or unit
216 // tests. Don't copy if this native_info came from 219 // tests. Don't copy if this native_info came from
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 262 }
260 263
261 gfx::Insets DisplayInfo::GetOverscanInsetsInPixel() const { 264 gfx::Insets DisplayInfo::GetOverscanInsetsInPixel() const {
262 return overscan_insets_in_dip_.Scale(device_scale_factor_); 265 return overscan_insets_in_dip_.Scale(device_scale_factor_);
263 } 266 }
264 267
265 std::string DisplayInfo::ToString() const { 268 std::string DisplayInfo::ToString() const {
266 int rotation_degree = static_cast<int>(rotation_) * 90; 269 int rotation_degree = static_cast<int>(rotation_) * 90;
267 return base::StringPrintf( 270 return base::StringPrintf(
268 "DisplayInfo[%lld] native bounds=%s, size=%s, scale=%f, " 271 "DisplayInfo[%lld] native bounds=%s, size=%s, scale=%f, "
269 "overscan=%s, rotation=%d, ui-scale=%f, touchscreen=%s", 272 "overscan=%s, rotation=%d, ui-scale=%f, touchscreen=%s, "
273 "touch-device-id=%d",
270 static_cast<long long int>(id_), 274 static_cast<long long int>(id_),
271 bounds_in_native_.ToString().c_str(), 275 bounds_in_native_.ToString().c_str(),
272 size_in_pixel_.ToString().c_str(), 276 size_in_pixel_.ToString().c_str(),
273 device_scale_factor_, 277 device_scale_factor_,
274 overscan_insets_in_dip_.ToString().c_str(), 278 overscan_insets_in_dip_.ToString().c_str(),
275 rotation_degree, 279 rotation_degree,
276 configured_ui_scale_, 280 configured_ui_scale_,
277 touch_support_ == gfx::Display::TOUCH_SUPPORT_AVAILABLE 281 touch_support_ == gfx::Display::TOUCH_SUPPORT_AVAILABLE
278 ? "yes" 282 ? "yes"
279 : touch_support_ == gfx::Display::TOUCH_SUPPORT_UNAVAILABLE 283 : touch_support_ == gfx::Display::TOUCH_SUPPORT_UNAVAILABLE
280 ? "no" 284 ? "no"
281 : "unknown"); 285 : "unknown",
286 touch_device_id_);
282 } 287 }
283 288
284 std::string DisplayInfo::ToFullString() const { 289 std::string DisplayInfo::ToFullString() const {
285 std::string display_modes_str; 290 std::string display_modes_str;
286 std::vector<DisplayMode>::const_iterator iter = display_modes_.begin(); 291 std::vector<DisplayMode>::const_iterator iter = display_modes_.begin();
287 for (; iter != display_modes_.end(); ++iter) { 292 for (; iter != display_modes_.end(); ++iter) {
288 if (!display_modes_str.empty()) 293 if (!display_modes_str.empty())
289 display_modes_str += ","; 294 display_modes_str += ",";
290 base::StringAppendF(&display_modes_str, 295 base::StringAppendF(&display_modes_str,
291 "(%dx%d@%f%c%s)", 296 "(%dx%d@%f%c%s)",
292 iter->size.width(), 297 iter->size.width(),
293 iter->size.height(), 298 iter->size.height(),
294 iter->refresh_rate, 299 iter->refresh_rate,
295 iter->interlaced ? 'I' : 'P', 300 iter->interlaced ? 'I' : 'P',
296 iter->native ? "(N)" : ""); 301 iter->native ? "(N)" : "");
297 } 302 }
298 return ToString() + ", display_modes==" + display_modes_str; 303 return ToString() + ", display_modes==" + display_modes_str;
299 } 304 }
300 305
301 } // namespace internal 306 } // namespace internal
302 } // namespace ash 307 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698