-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Canvas.drawPoints takes a List<Offset>, which isn't the most efficient way to pack the data for the points. We already convert the List<Offset> to a Float32List before sending the data over to C++. We can make drawPoints faster by letting the caller supply the Float32List directly. The other advantage of this approach is that the caller can use the view feature of Float32List to draw subsets of the points without needing to reallocate the storage.
We have a couple options:
- Add a new
drawPointsFoomethod that takes aFloat32Listand keep the older, slowerdrawPointsthat takes aList<Offset>. - Break the API and change
drawPointsto take adrawPoints.
In the future, we might be able to add back support for List<Offset> if Dart adds support for method overloading.
The purpose of this bug is to gather community feedback on these options. I believe this API is not widely used yet, which makes me think that option (2) is better, but I'm interested in your thoughts. Hopefully we'll be able to make a decision in about a week. Thanks!