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

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

Issue 2519993002: Move kInvalidDisplayID to display_constants.h. (Closed)
Patch Set: Address comments. Created 4 years 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') | ui/display/fake_display_delegate.cc » ('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) 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // static 70 // static
71 void Display::ResetForceDeviceScaleFactorForTesting() { 71 void Display::ResetForceDeviceScaleFactorForTesting() {
72 g_has_forced_device_scale_factor = -1; 72 g_has_forced_device_scale_factor = -1;
73 g_forced_device_scale_factor = -1.0; 73 g_forced_device_scale_factor = -1.0;
74 } 74 }
75 75
76 constexpr int DEFAULT_BITS_PER_PIXEL = 24; 76 constexpr int DEFAULT_BITS_PER_PIXEL = 24;
77 constexpr int DEFAULT_BITS_PER_COMPONENT = 8; 77 constexpr int DEFAULT_BITS_PER_COMPONENT = 8;
78 78
79 Display::Display() : Display(kInvalidDisplayID) {} 79 Display::Display() : Display(kInvalidDisplayId) {}
80 80
81 Display::Display(int64_t id) : Display(id, gfx::Rect()) {} 81 Display::Display(int64_t id) : Display(id, gfx::Rect()) {}
82 82
83 Display::Display(int64_t id, const gfx::Rect& bounds) 83 Display::Display(int64_t id, const gfx::Rect& bounds)
84 : id_(id), 84 : id_(id),
85 bounds_(bounds), 85 bounds_(bounds),
86 work_area_(bounds), 86 work_area_(bounds),
87 device_scale_factor_(GetForcedDeviceScaleFactor()), 87 device_scale_factor_(GetForcedDeviceScaleFactor()),
88 color_depth_(DEFAULT_BITS_PER_PIXEL), 88 color_depth_(DEFAULT_BITS_PER_PIXEL),
89 depth_per_component_(DEFAULT_BITS_PER_COMPONENT) { 89 depth_per_component_(DEFAULT_BITS_PER_COMPONENT) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 work_area_.ToString().c_str(), device_scale_factor_, 180 work_area_.ToString().c_str(), device_scale_factor_,
181 IsInternal() ? "internal" : "external"); 181 IsInternal() ? "internal" : "external");
182 } 182 }
183 183
184 bool Display::IsInternal() const { 184 bool Display::IsInternal() const {
185 return is_valid() && (id_ == internal_display_id_); 185 return is_valid() && (id_ == internal_display_id_);
186 } 186 }
187 187
188 // static 188 // static
189 int64_t Display::InternalDisplayId() { 189 int64_t Display::InternalDisplayId() {
190 DCHECK_NE(kInvalidDisplayID, internal_display_id_); 190 DCHECK_NE(kInvalidDisplayId, internal_display_id_);
191 return internal_display_id_; 191 return internal_display_id_;
192 } 192 }
193 193
194 // static 194 // static
195 void Display::SetInternalDisplayId(int64_t internal_display_id) { 195 void Display::SetInternalDisplayId(int64_t internal_display_id) {
196 internal_display_id_ = internal_display_id; 196 internal_display_id_ = internal_display_id;
197 } 197 }
198 198
199 // static 199 // static
200 bool Display::IsInternalDisplayId(int64_t display_id) { 200 bool Display::IsInternalDisplayId(int64_t display_id) {
201 DCHECK_NE(kInvalidDisplayID, display_id); 201 DCHECK_NE(kInvalidDisplayId, display_id);
202 return HasInternalDisplay() && internal_display_id_ == display_id; 202 return HasInternalDisplay() && internal_display_id_ == display_id;
203 } 203 }
204 204
205 // static 205 // static
206 bool Display::HasInternalDisplay() { 206 bool Display::HasInternalDisplay() {
207 return internal_display_id_ != kInvalidDisplayID; 207 return internal_display_id_ != kInvalidDisplayId;
208 } 208 }
209 209
210 } // namespace display 210 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/display.h ('k') | ui/display/fake_display_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698