-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Change Path::CreatePolyline from tolerance to scale, and make it required #39917
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An "unused parameter" check wouldn't have caught this, since we use the parameter later in the method.
I think this makes sense. If only for TUs handled by the impeller_component
GN template. We can fixup existing issues by either dropping the argument name or explicitly annotating it as being unused.
EDIT: Can we file a bug this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I have a questions about what should happen scale=0, but that concern is preexisting/not introduced by this PR.
Polyline polyline; | ||
auto tolerance = kDefaultCurveTolerance / scale; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, it's acceptable for tolerance to end up being NaN (when the max basis length is 0). Is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, curves ending reverting to lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#38497 (comment) is where you discussed this before
impeller/geometry/path.h
Outdated
/// transformed. | ||
/// | ||
/// It is suitable to use the max basis length of the matrix used to transform | ||
/// the path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Maybe mention what will happen when scale is 0 here. E.g. will curves revert to lines (seems like the most reasonable behavior)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…ale, and make it required (flutter/engine#39917)
Fixes flutter/flutter#121540
See also dnfield/flutter_svg#830 which has screenshots.
This patch mainly does two things:
StrokePathGeometry::CreateSolidStrokeVertices
). An "unused parameter" check wouldn't have caught this, since we use the parameter later in the method.tolerance
parameter onPath::CreatePolyilne
to ascale
parameter and removes the default. This should prevent this error from happening in the future.Ideally we'd also have a test that
CreateSolidStrokeVertices
. That would require either friendship or making it public. I'm open to doing that if reviewers think it would be helpful. We do risk regression here if someone uses an incorrect value for the scale in the future.