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

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

Issue 417113012: Introduce user customization of external HighDPI mode for 4K monitor. (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_info.h ('k') | ash/display/display_manager.h » ('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) 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 11 matching lines...) Expand all
22 22
23 namespace ash { 23 namespace ash {
24 namespace { 24 namespace {
25 25
26 // TODO(oshima): This feature is obsolete. Remove this after m38. 26 // TODO(oshima): This feature is obsolete. Remove this after m38.
27 bool allow_upgrade_to_high_dpi = false; 27 bool allow_upgrade_to_high_dpi = false;
28 28
29 } 29 }
30 30
31 DisplayMode::DisplayMode() 31 DisplayMode::DisplayMode()
32 : refresh_rate(0.0f), interlaced(false), native(false) {} 32 : refresh_rate(0.0f),
33 interlaced(false),
34 native(false),
35 ui_scale(1.0f),
36 device_scale_factor(1.0f) {}
33 37
34 DisplayMode::DisplayMode(const gfx::Size& size, 38 DisplayMode::DisplayMode(const gfx::Size& size,
35 float refresh_rate, 39 float refresh_rate,
36 bool interlaced, 40 bool interlaced,
37 bool native) 41 bool native)
38 : size(size), 42 : size(size),
39 refresh_rate(refresh_rate), 43 refresh_rate(refresh_rate),
40 interlaced(interlaced), 44 interlaced(interlaced),
41 native(native) {} 45 native(native),
46 ui_scale(1.0f),
47 device_scale_factor(1.0f) {}
48
49 gfx::Size DisplayMode::GetSizeInDIP() const {
50 gfx::SizeF size_dip(size);
51 size_dip.Scale(ui_scale);
52 size_dip.Scale(1.0f / device_scale_factor);
53 return gfx::ToFlooredSize(size_dip);
54 }
55
56 bool DisplayMode::IsEquivalent(const DisplayMode& other) const {
57 const float kEpsilon = 0.0001f;
58 return size == other.size &&
59 std::abs(ui_scale - other.ui_scale) < kEpsilon &&
60 std::abs(device_scale_factor - other.device_scale_factor) < kEpsilon;
61 }
42 62
43 // satic 63 // satic
44 DisplayInfo DisplayInfo::CreateFromSpec(const std::string& spec) { 64 DisplayInfo DisplayInfo::CreateFromSpec(const std::string& spec) {
45 return CreateFromSpecWithID(spec, gfx::Display::kInvalidDisplayID); 65 return CreateFromSpecWithID(spec, gfx::Display::kInvalidDisplayID);
46 } 66 }
47 67
48 // static 68 // static
49 void DisplayInfo::SetAllowUpgradeToHighDPI(bool enable) { 69 void DisplayInfo::SetAllowUpgradeToHighDPI(bool enable) {
50 allow_upgrade_to_high_dpi = enable; 70 allow_upgrade_to_high_dpi = enable;
51 } 71 }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 360 }
341 361
342 bool DisplayInfo::IsColorProfileAvailable( 362 bool DisplayInfo::IsColorProfileAvailable(
343 ui::ColorCalibrationProfile profile) const { 363 ui::ColorCalibrationProfile profile) const {
344 return std::find(available_color_profiles_.begin(), 364 return std::find(available_color_profiles_.begin(),
345 available_color_profiles_.end(), 365 available_color_profiles_.end(),
346 profile) != available_color_profiles_.end(); 366 profile) != available_color_profiles_.end();
347 } 367 }
348 368
349 } // namespace ash 369 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_info.h ('k') | ash/display/display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698