OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ | |
6 #define SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ | |
7 | |
8 #include "base/strings/stringprintf.h" | |
9 #include "ui/display/display.h" | |
10 #include "ui/gfx/geometry/rect.h" | |
11 #include "ui/gfx/geometry/size.h" | |
12 | |
13 namespace display { | |
14 | |
15 struct ViewportMetrics { | |
16 std::string ToString() const { | |
17 return base::StringPrintf( | |
sky
2016/10/19 23:37:59
Please move this to viewport_metrics.cc
kylechar
2016/10/20 15:04:19
Done.
| |
18 "ViewportMetrics(bounds=%s, work_area=%s, pixel_size=%s, " | |
19 "device_scale_factor=%g)", | |
20 bounds.ToString().c_str(), work_area.ToString().c_str(), | |
21 pixel_size.ToString().c_str(), device_scale_factor); | |
22 } | |
23 | |
24 gfx::Rect bounds; // DIP. | |
25 gfx::Rect work_area; // DIP. | |
26 gfx::Size pixel_size; | |
27 display::Display::Rotation rotation = display::Display::ROTATE_0; | |
28 float device_scale_factor = 0.0f; | |
29 }; | |
30 | |
31 inline bool operator==(const ViewportMetrics& lhs, const ViewportMetrics& rhs) { | |
32 return lhs.bounds == rhs.bounds && lhs.work_area == rhs.work_area && | |
33 lhs.pixel_size == rhs.pixel_size && lhs.rotation == rhs.rotation && | |
34 lhs.device_scale_factor == rhs.device_scale_factor; | |
35 } | |
36 | |
37 inline bool operator!=(const ViewportMetrics& lhs, const ViewportMetrics& rhs) { | |
38 return !(lhs == rhs); | |
39 } | |
40 | |
41 } // namespace display | |
42 | |
43 #endif // SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ | |
OLD | NEW |