Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
ch...@google.com <ch...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
na...@google.com <na...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.graphics:graphics-shapes:1.0.0-alpha04
Description
We should look into the various places in the APIs where these surface to ensure that this is the API we want before going to beta.
For example, Cubic is constructed with PointF objects, which it exposes as vals. This is worth considering in several ways:
- Having the points available for inspection is good, but we don't want the data to be changed in the underlying cubics (which is possible since PointF is mutable)
- It might not make sense to even have a public constructor; Cubics are necessary for callers to be able to inspect a Polygon (and maybe render debug information for it). But the object is mostly an implementation detail of this API, so it seems unnecessary to expose the constructor(s).
- We might want to use Float internally, regardless of what is used to construct a Cubic. This might help with both performance/allocations internally and avoiding mutability from the PointFs that callers can see
- If we use Float internally, and opt to avoid public constructors, then we might as well use Floats to construct Cubics as well, to avoid allocating PointF objects just to construct a Cubic
- If PointF is only used as a way to return data from a Cubic to a caller, then we could lazily allocate those objects