sony / flutter-embedded-linux

Embedded Linux embedding for Flutter
BSD 3-Clause "New" or "Revised" License
1.2k stars 127 forks source link

Annotate code with coordinate system information #313

Closed vially closed 1 year ago

vially commented 1 year ago

Warning

There are still parts of the code-base which are missing these annotations and would benefit from them. Therefore, this pull-request should be seen more like a starting point for this work.

This pull-request should contain no functional changes. It is only meant to annotate various methods and attributes with explicit information about whether logical or physical pixels are being used.

The current usage patterns have been used to determine whether to mark existing code as dealing with physical or logical coordinates.

This is part of a larger set of changes that are meant to add HighDPI support for Wayland.

Naming conventions

The _px and _dip suffixes are sometimes used for variables depending on whether their data represents physical or logical pixels respectively. Obviously, this is not strictly necessary but it does make it easier to differentiate between the two when writing code that deals with both coordinate systems.

In Wayland terms, buffer coordinates correspond to physical pixels and surface coordinates correspond to logical pixels. Usually the relationship between the two is: buffer_size = surface_size x output_scale.

Note: I agree to delegate all rights related to this PR to Sony.