Index: services/ui/display/viewport_metrics.h |
diff --git a/services/ui/display/viewport_metrics.h b/services/ui/display/viewport_metrics.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2d605664340dee00040f1ce595bf1674cd6eef78 |
--- /dev/null |
+++ b/services/ui/display/viewport_metrics.h |
@@ -0,0 +1,43 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ |
+#define SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ |
+ |
+#include "base/strings/stringprintf.h" |
+#include "ui/display/display.h" |
+#include "ui/gfx/geometry/rect.h" |
+#include "ui/gfx/geometry/size.h" |
+ |
+namespace display { |
+ |
+struct ViewportMetrics { |
+ std::string ToString() const { |
+ 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.
|
+ "ViewportMetrics(bounds=%s, work_area=%s, pixel_size=%s, " |
+ "device_scale_factor=%g)", |
+ bounds.ToString().c_str(), work_area.ToString().c_str(), |
+ pixel_size.ToString().c_str(), device_scale_factor); |
+ } |
+ |
+ gfx::Rect bounds; // DIP. |
+ gfx::Rect work_area; // DIP. |
+ gfx::Size pixel_size; |
+ display::Display::Rotation rotation = display::Display::ROTATE_0; |
+ float device_scale_factor = 0.0f; |
+}; |
+ |
+inline bool operator==(const ViewportMetrics& lhs, const ViewportMetrics& rhs) { |
+ return lhs.bounds == rhs.bounds && lhs.work_area == rhs.work_area && |
+ lhs.pixel_size == rhs.pixel_size && lhs.rotation == rhs.rotation && |
+ lhs.device_scale_factor == rhs.device_scale_factor; |
+} |
+ |
+inline bool operator!=(const ViewportMetrics& lhs, const ViewportMetrics& rhs) { |
+ return !(lhs == rhs); |
+} |
+ |
+} // namespace display |
+ |
+#endif // SERVICES_UI_DISPLAY_VIEWPORT_METRICS_H_ |