Flutter Engine
viewport_metrics.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 #include "flutter/lib/ui/window/viewport_metrics.h"
6 
7 #include "flutter/fml/logging.h"
8 
9 namespace flutter {
10 
12 
13 ViewportMetrics::ViewportMetrics(double p_device_pixel_ratio,
14  double p_physical_width,
15  double p_physical_height,
16  double p_physical_touch_slop)
17  : device_pixel_ratio(p_device_pixel_ratio),
18  physical_width(p_physical_width),
19  physical_height(p_physical_height),
20  physical_touch_slop(p_physical_touch_slop) {}
21 
22 ViewportMetrics::ViewportMetrics(double p_device_pixel_ratio,
23  double p_physical_width,
24  double p_physical_height,
25  double p_physical_padding_top,
26  double p_physical_padding_right,
27  double p_physical_padding_bottom,
28  double p_physical_padding_left,
29  double p_physical_view_inset_top,
30  double p_physical_view_inset_right,
31  double p_physical_view_inset_bottom,
32  double p_physical_view_inset_left,
33  double p_physical_system_gesture_inset_top,
34  double p_physical_system_gesture_inset_right,
35  double p_physical_system_gesture_inset_bottom,
36  double p_physical_system_gesture_inset_left,
37  double p_physical_touch_slop)
38  : device_pixel_ratio(p_device_pixel_ratio),
39  physical_width(p_physical_width),
40  physical_height(p_physical_height),
41  physical_padding_top(p_physical_padding_top),
42  physical_padding_right(p_physical_padding_right),
43  physical_padding_bottom(p_physical_padding_bottom),
44  physical_padding_left(p_physical_padding_left),
45  physical_view_inset_top(p_physical_view_inset_top),
46  physical_view_inset_right(p_physical_view_inset_right),
47  physical_view_inset_bottom(p_physical_view_inset_bottom),
48  physical_view_inset_left(p_physical_view_inset_left),
49  physical_system_gesture_inset_top(p_physical_system_gesture_inset_top),
51  p_physical_system_gesture_inset_right),
53  p_physical_system_gesture_inset_bottom),
54  physical_system_gesture_inset_left(p_physical_system_gesture_inset_left),
55  physical_touch_slop(p_physical_touch_slop) {}
56 
57 bool operator==(const ViewportMetrics& a, const ViewportMetrics& b) {
58  return a.device_pixel_ratio == b.device_pixel_ratio &&
78 }
79 
80 std::ostream& operator<<(std::ostream& os, const ViewportMetrics& a) {
81  os << "DPR: " << a.device_pixel_ratio << " "
82  << "Size: [" << a.physical_width << "W " << a.physical_height << "H] "
83  << "Padding: [" << a.physical_padding_top << "T "
84  << a.physical_padding_right << "R " << a.physical_padding_bottom << "B "
85  << a.physical_padding_left << "L] "
86  << "Insets: [" << a.physical_view_inset_top << "T "
88  << "B " << a.physical_view_inset_left << "L] "
89  << "Gesture Insets: [" << a.physical_system_gesture_inset_top << "T "
93  return os;
94 }
95 
96 } // namespace flutter
std::ostream & operator<<(std::ostream &os, const ViewportMetrics &a)
bool operator==(const ViewportMetrics &a, const ViewportMetrics &b)