Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
flutter::PointerDataPacketConverter Class Reference

#include <pointer_data_packet_converter.h>

Public Member Functions

 PointerDataPacketConverter ()
 
 ~PointerDataPacketConverter ()
 
std::unique_ptr< PointerDataPacketConvert (std::unique_ptr< PointerDataPacket > packet)
 Converts pointer data packet into a form that framework understands. The raw pointer data packet from embedding does not have sufficient information and may contain illegal pointer transitions. This method will fill out that information and attempt to correct pointer transitions.
 

Detailed Description

Converter to convert the raw pointer data packet from the platforms.

Framework requires certain information to process pointer data. e.g. pointer identifier and the delta of pointer moment. The converter keeps track each pointer state and fill in those information appropriately.

The converter is also resposible for providing a clean pointer data stream. It will attempt to correct the stream if the it contains illegal pointer transitions.

Example 1 Missing Add:

Down(position x) -> Up(position x)

###After Conversion###

Synthesized_Add(position x) -> Down(position x) -> Up(position x)

Example 2 Missing another move:

Add(position x) -> Down(position x) -> Move(position y) ->
Up(position z)

###After Conversion###

Add(position x) -> Down(position x) -> Move(position y) ->
Synthesized_Move(position z) -> Up(position z)

Platform view is the only client that uses this class to convert all the incoming pointer packet and is responsible for the life cycle of its instance.

Definition at line 76 of file pointer_data_packet_converter.h.

Constructor & Destructor Documentation

◆ PointerDataPacketConverter()

flutter::PointerDataPacketConverter::PointerDataPacketConverter ( )

Definition at line 14 of file pointer_data_packet_converter.cc.

14{}

◆ ~PointerDataPacketConverter()

flutter::PointerDataPacketConverter::~PointerDataPacketConverter ( )
default

Member Function Documentation

◆ Convert()

std::unique_ptr< PointerDataPacket > flutter::PointerDataPacketConverter::Convert ( std::unique_ptr< PointerDataPacket packet)

Converts pointer data packet into a form that framework understands. The raw pointer data packet from embedding does not have sufficient information and may contain illegal pointer transitions. This method will fill out that information and attempt to correct pointer transitions.

Parameters
[in]packetThe raw pointer packet sent from embedding.
Returns
A full converted packet with all the required information filled. It may contain synthetic pointer data as the result of converter's attempt to correct illegal pointer transitions.

Definition at line 18 of file pointer_data_packet_converter.cc.

19 {
20 std::vector<PointerData> converted_pointers;
21 // Converts each pointer data in the buffer and stores it in the
22 // converted_pointers.
23 for (size_t i = 0; i < packet->GetLength(); i++) {
24 PointerData pointer_data = packet->GetPointerData(i);
25 ConvertPointerData(pointer_data, converted_pointers);
26 }
27
28 // Writes converted_pointers into converted_packet.
29 auto converted_packet =
30 std::make_unique<flutter::PointerDataPacket>(converted_pointers.size());
31 size_t count = 0;
32 for (auto& converted_pointer : converted_pointers) {
33 converted_packet->SetPointerData(count++, converted_pointer);
34 }
35
36 return converted_packet;
37}
int count

The documentation for this class was generated from the following files: