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/display/display.h" | 5 #include "ui/display/display.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 #if defined(USE_AURA) | 97 #if defined(USE_AURA) |
98 SetScaleAndBounds(device_scale_factor_, bounds); | 98 SetScaleAndBounds(device_scale_factor_, bounds); |
99 #endif | 99 #endif |
100 } | 100 } |
101 | 101 |
102 Display::Display(const Display& other) = default; | 102 Display::Display(const Display& other) = default; |
103 | 103 |
104 Display::~Display() {} | 104 Display::~Display() {} |
105 | 105 |
106 int Display::RotationAsDegree() const { | 106 // static |
107 switch (rotation_) { | 107 int Display::RotationAsDegree(Rotation rotation) { |
| 108 switch (rotation) { |
108 case ROTATE_0: | 109 case ROTATE_0: |
109 return 0; | 110 return 0; |
110 case ROTATE_90: | 111 case ROTATE_90: |
111 return 90; | 112 return 90; |
112 case ROTATE_180: | 113 case ROTATE_180: |
113 return 180; | 114 return 180; |
114 case ROTATE_270: | 115 case ROTATE_270: |
115 return 270; | 116 return 270; |
116 } | 117 } |
117 NOTREACHED(); | 118 NOTREACHED(); |
118 return 0; | 119 return 0; |
119 } | 120 } |
120 | 121 |
| 122 int Display::RotationAsDegree() const { |
| 123 return RotationAsDegree(rotation_); |
| 124 } |
| 125 |
121 void Display::SetRotationAsDegree(int rotation) { | 126 void Display::SetRotationAsDegree(int rotation) { |
122 switch (rotation) { | 127 switch (rotation) { |
123 case 0: | 128 case 0: |
124 rotation_ = ROTATE_0; | 129 rotation_ = ROTATE_0; |
125 break; | 130 break; |
126 case 90: | 131 case 90: |
127 rotation_ = ROTATE_90; | 132 rotation_ = ROTATE_90; |
128 break; | 133 break; |
129 case 180: | 134 case 180: |
130 rotation_ = ROTATE_180; | 135 rotation_ = ROTATE_180; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 DCHECK_NE(kInvalidDisplayId, display_id); | 219 DCHECK_NE(kInvalidDisplayId, display_id); |
215 return HasInternalDisplay() && internal_display_id_ == display_id; | 220 return HasInternalDisplay() && internal_display_id_ == display_id; |
216 } | 221 } |
217 | 222 |
218 // static | 223 // static |
219 bool Display::HasInternalDisplay() { | 224 bool Display::HasInternalDisplay() { |
220 return internal_display_id_ != kInvalidDisplayId; | 225 return internal_display_id_ != kInvalidDisplayId; |
221 } | 226 } |
222 | 227 |
223 } // namespace display | 228 } // namespace display |
OLD | NEW |