OLD | NEW |
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 "ui/gfx/display.h" | 5 #include "ui/gfx/display.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 // static | 35 // static |
36 float Display::GetForcedDeviceScaleFactor() { | 36 float Display::GetForcedDeviceScaleFactor() { |
37 static const float kForcedDeviceScaleFactor = | 37 static const float kForcedDeviceScaleFactor = |
38 GetForcedDeviceScaleFactorImpl(); | 38 GetForcedDeviceScaleFactorImpl(); |
39 return kForcedDeviceScaleFactor; | 39 return kForcedDeviceScaleFactor; |
40 } | 40 } |
41 | 41 |
| 42 // static |
| 43 int64 Display::GetID(uint16 manufacturer_id, uint32 serial_number) { |
| 44 return ((static_cast<int64>(manufacturer_id) << 32) | serial_number); |
| 45 } |
| 46 |
42 Display::Display() | 47 Display::Display() |
43 : id_(-1), | 48 : id_(-1), |
44 device_scale_factor_(GetForcedDeviceScaleFactor()) { | 49 device_scale_factor_(GetForcedDeviceScaleFactor()) { |
45 } | 50 } |
46 | 51 |
47 Display::Display(int id) | 52 Display::Display(int64 id) |
48 : id_(id), | 53 : id_(id), |
49 device_scale_factor_(GetForcedDeviceScaleFactor()) { | 54 device_scale_factor_(GetForcedDeviceScaleFactor()) { |
50 } | 55 } |
51 | 56 |
52 Display::Display(int id, const gfx::Rect& bounds) | 57 Display::Display(int64 id, const gfx::Rect& bounds) |
53 : id_(id), | 58 : id_(id), |
54 bounds_(bounds), | 59 bounds_(bounds), |
55 work_area_(bounds), | 60 work_area_(bounds), |
56 device_scale_factor_(GetForcedDeviceScaleFactor()) { | 61 device_scale_factor_(GetForcedDeviceScaleFactor()) { |
57 #if defined(USE_AURA) | 62 #if defined(USE_AURA) |
58 SetScaleAndBounds(device_scale_factor_, bounds); | 63 SetScaleAndBounds(device_scale_factor_, bounds); |
59 #endif | 64 #endif |
60 } | 65 } |
61 | 66 |
62 Display::~Display() { | 67 Display::~Display() { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void Display::UpdateWorkAreaFromInsets(const gfx::Insets& insets) { | 101 void Display::UpdateWorkAreaFromInsets(const gfx::Insets& insets) { |
97 work_area_ = bounds_; | 102 work_area_ = bounds_; |
98 work_area_.Inset(insets); | 103 work_area_.Inset(insets); |
99 } | 104 } |
100 | 105 |
101 gfx::Size Display::GetSizeInPixel() const { | 106 gfx::Size Display::GetSizeInPixel() const { |
102 return size().Scale(device_scale_factor_); | 107 return size().Scale(device_scale_factor_); |
103 } | 108 } |
104 | 109 |
105 std::string Display::ToString() const { | 110 std::string Display::ToString() const { |
106 return base::StringPrintf("Display[%d] bounds=%s, workarea=%s, scale=%f", | 111 return base::StringPrintf("Display[%lld] bounds=%s, workarea=%s, scale=%f", |
107 id_, | 112 static_cast<long long int>(id_), |
108 bounds_.ToString().c_str(), | 113 bounds_.ToString().c_str(), |
109 work_area_.ToString().c_str(), | 114 work_area_.ToString().c_str(), |
110 device_scale_factor_); | 115 device_scale_factor_); |
111 } | 116 } |
112 | 117 |
113 } // namespace gfx | 118 } // namespace gfx |
OLD | NEW |