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

Side by Side Diff: ui/display/display.cc

Issue 2777343002: exo: Rotate cursor snapshot for rotated displays (Closed)
Patch Set: Add comment Created 3 years, 7 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
« no previous file with comments | « ui/display/display.h ('k') | no next file » | 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) 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #if defined(USE_AURA) 108 #if defined(USE_AURA)
109 SetScaleAndBounds(device_scale_factor_, bounds); 109 SetScaleAndBounds(device_scale_factor_, bounds);
110 #endif 110 #endif
111 } 111 }
112 112
113 Display::Display(const Display& other) = default; 113 Display::Display(const Display& other) = default;
114 114
115 Display::~Display() {} 115 Display::~Display() {}
116 116
117 int Display::RotationAsDegree() const { 117 int Display::RotationAsDegree() const {
118 switch (rotation_) { 118 return RotateToDegree(rotation_);
119 case ROTATE_0:
120 return 0;
121 case ROTATE_90:
122 return 90;
123 case ROTATE_180:
124 return 180;
125 case ROTATE_270:
126 return 270;
127 }
128 NOTREACHED();
129 return 0;
130 } 119 }
131 120
132 void Display::SetRotationAsDegree(int rotation) { 121 void Display::SetRotationAsDegree(int rotation) {
133 switch (rotation) { 122 switch (rotation) {
134 case 0: 123 case 0:
135 rotation_ = ROTATE_0; 124 rotation_ = ROTATE_0;
136 break; 125 break;
137 case 90: 126 case 90:
138 rotation_ = ROTATE_90; 127 rotation_ = ROTATE_90;
139 break; 128 break;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 bool Display::IsInternalDisplayId(int64_t display_id) { 213 bool Display::IsInternalDisplayId(int64_t display_id) {
225 DCHECK_NE(kInvalidDisplayId, display_id); 214 DCHECK_NE(kInvalidDisplayId, display_id);
226 return HasInternalDisplay() && internal_display_id_ == display_id; 215 return HasInternalDisplay() && internal_display_id_ == display_id;
227 } 216 }
228 217
229 // static 218 // static
230 bool Display::HasInternalDisplay() { 219 bool Display::HasInternalDisplay() {
231 return internal_display_id_ != kInvalidDisplayId; 220 return internal_display_id_ != kInvalidDisplayId;
232 } 221 }
233 222
223 // static
224 int Display::RotateToDegree(Rotation rotation) {
225 switch (rotation) {
226 case ROTATE_0:
227 return 0;
228 case ROTATE_90:
229 return 90;
230 case ROTATE_180:
231 return 180;
232 case ROTATE_270:
233 return 270;
234 }
235 NOTREACHED();
236 return 0;
237 }
238
234 } // namespace display 239 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/display.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698