22 std::array<std::array<float, 2>, 2> view,
23 std::array<std::array<float, 2>, 2> viewport,
26 fuchsia::ui::pointer::Rectangle view_rect;
27 view_rect.min = view[0];
28 view_rect.max = view[1];
30 fuchsia::ui::pointer::Rectangle viewport_rect;
31 viewport_rect.min = viewport[0];
32 viewport_rect.max = viewport[1];
33 params.viewport = viewport_rect;
51 std::array<float, 2> position) {
52 sample_ = std::make_optional<fup_TouchPointerSample>();
53 sample_->set_interaction(
id);
54 sample_->set_phase(phase);
55 sample_->set_position_in_viewport(position);
60 std::array<std::array<float, 2>, 2> view,
61 std::array<std::array<float, 2>, 2> viewport,
63 params_ = CreateViewParameters(std::move(view), std::move(viewport),
76 event.set_timestamp(time_.value());
79 event.set_view_parameters(std::move(params_.value()));
82 event.set_pointer_sample(std::move(sample_.value()));
85 event.set_interaction_result(std::move(result_.value()));
91 std::vector<fup_TouchEvent> events;
92 events.emplace_back(
Build());
107 std::array<float, 2> position,
108 std::vector<uint8_t> pressed_buttons,
109 std::array<int64_t, 2> scroll,
110 std::array<int64_t, 2> scroll_in_physical_pixel,
111 bool is_precision_scroll) {
112 sample_ = std::make_optional<fup_MousePointerSample>();
113 sample_->set_device_id(
id);
114 if (!pressed_buttons.empty()) {
115 sample_->set_pressed_buttons(pressed_buttons);
117 sample_->set_position_in_viewport(position);
118 if (scroll[0] != 0) {
119 sample_->set_scroll_h(scroll[0]);
121 if (scroll[1] != 0) {
122 sample_->set_scroll_v(scroll[1]);
124 if (scroll_in_physical_pixel[0] != 0) {
125 sample_->set_scroll_h_physical_pixel(scroll_in_physical_pixel[0]);
127 if (scroll_in_physical_pixel[1] != 0) {
128 sample_->set_scroll_v_physical_pixel(scroll_in_physical_pixel[1]);
130 sample_->set_is_precision_scroll(is_precision_scroll);
135 std::array<std::array<float, 2>, 2> view,
136 std::array<std::array<float, 2>, 2> viewport,
138 params_ = CreateViewParameters(std::move(view), std::move(viewport),
145 std::vector<uint8_t> buttons) {
146 device_info_ = std::make_optional<fup_MouseDeviceInfo>();
147 device_info_->set_id(
id);
148 device_info_->set_buttons(buttons);
155 event.set_timestamp(time_.value());
158 event.set_view_parameters(std::move(params_.value()));
161 event.set_pointer_sample(std::move(sample_.value()));
164 event.set_device_info(std::move(device_info_.value()));
166 event.set_trace_flow_id(123);
171 std::vector<fup_MouseEvent> events;
172 events.emplace_back(
Build());
fuchsia::ui::pointer::MouseEvent Build()
MouseEventBuilder & AddSample(uint32_t id, std::array< float, 2 > position, std::vector< uint8_t > pressed_buttons, std::array< int64_t, 2 > scroll, std::array< int64_t, 2 > scroll_in_physical_pixel, bool is_precision_scroll)
static MouseEventBuilder New()
std::vector< fuchsia::ui::pointer::MouseEvent > BuildAsVector()
MouseEventBuilder & AddViewParameters(std::array< std::array< float, 2 >, 2 > view, std::array< std::array< float, 2 >, 2 > viewport, std::array< float, 9 > transform)
MouseEventBuilder & AddTime(zx_time_t time)
MouseEventBuilder & AddMouseDeviceInfo(uint32_t id, std::vector< uint8_t > buttons)
std::vector< fuchsia::ui::pointer::TouchEvent > BuildAsVector()
fuchsia::ui::pointer::TouchEvent Build()
TouchEventBuilder & AddViewParameters(std::array< std::array< float, 2 >, 2 > view, std::array< std::array< float, 2 >, 2 > viewport, std::array< float, 9 > transform)
TouchEventBuilder & AddSample(fuchsia::ui::pointer::TouchInteractionId id, fuchsia::ui::pointer::EventPhase phase, std::array< float, 2 > position)
static TouchEventBuilder New()
TouchEventBuilder & AddTime(zx_time_t time)
TouchEventBuilder & AddResult(fuchsia::ui::pointer::TouchInteractionResult result)
const EmbeddedViewParams * params
fuchsia::ui::pointer::TouchEvent fup_TouchEvent
fuchsia::ui::pointer::EventPhase fup_EventPhase
fuchsia::ui::pointer::MouseDeviceInfo fup_MouseDeviceInfo
fuchsia::ui::pointer::TouchPointerSample fup_TouchPointerSample
fuchsia::ui::pointer::MousePointerSample fup_MousePointerSample
fuchsia::ui::pointer::TouchInteractionResult fup_TouchIxnResult
fuchsia::ui::pointer::MouseEvent fup_MouseEvent
fuchsia::ui::pointer::ViewParameters fup_ViewParameters
fuchsia::ui::pointer::TouchInteractionId fup_TouchIxnId
static double time(int loops, Benchmark *bench, Target *target)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)