| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ | 5 #ifndef SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ |
| 6 #define SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ | 6 #define SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ui/display/display.h" | |
| 11 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/geometry/size.h" | |
| 13 | 11 |
| 14 namespace display { | 12 namespace display { |
| 15 | 13 |
| 16 struct ViewportMetrics { | 14 struct ViewportMetrics { |
| 17 std::string ToString() const; | 15 std::string ToString() const; |
| 18 | 16 |
| 19 gfx::Rect bounds; // DIP. | 17 gfx::Rect bounds_in_pixels; |
| 20 gfx::Rect work_area; // DIP. | |
| 21 gfx::Size pixel_size; | |
| 22 Display::Rotation rotation = Display::ROTATE_0; | |
| 23 Display::TouchSupport touch_support = Display::TOUCH_SUPPORT_UNKNOWN; | |
| 24 float device_scale_factor = 0.0f; | 18 float device_scale_factor = 0.0f; |
| 25 float ui_scale_factor = 0.0f; | 19 float ui_scale_factor = 0.0f; |
| 26 }; | 20 }; |
| 27 | 21 |
| 28 inline bool operator==(const ViewportMetrics& lhs, const ViewportMetrics& rhs) { | 22 inline bool operator==(const ViewportMetrics& lhs, const ViewportMetrics& rhs) { |
| 29 return lhs.bounds == rhs.bounds && lhs.work_area == rhs.work_area && | 23 return lhs.bounds_in_pixels == rhs.bounds_in_pixels && |
| 30 lhs.pixel_size == rhs.pixel_size && lhs.rotation == rhs.rotation && | |
| 31 lhs.touch_support == rhs.touch_support && | |
| 32 lhs.device_scale_factor == rhs.device_scale_factor && | 24 lhs.device_scale_factor == rhs.device_scale_factor && |
| 33 lhs.ui_scale_factor == rhs.ui_scale_factor; | 25 lhs.ui_scale_factor == rhs.ui_scale_factor; |
| 34 } | 26 } |
| 35 | 27 |
| 36 inline bool operator!=(const ViewportMetrics& lhs, const ViewportMetrics& rhs) { | 28 inline bool operator!=(const ViewportMetrics& lhs, const ViewportMetrics& rhs) { |
| 37 return !(lhs == rhs); | 29 return !(lhs == rhs); |
| 38 } | 30 } |
| 39 | 31 |
| 40 } // namespace display | 32 } // namespace display |
| 41 | 33 |
| 42 #endif // SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ | 34 #endif // SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ |
| OLD | NEW |