-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.team-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Description
NaN is never a useful value to have in geometry classes (e.g. Rect, Matrix, Path, RRect).
If possible, in debug mode it would be nice to trap NaNs that show up in the geometry. I ran into this today while debugging an issue like this:
auto rect = impeller_object.GetCoverage().value_or(Rect());
auto sk_rect = SkRect::MakeXYWH(rect.origin.x, rect.origin.y, rect.bounds.width, rect.bounds.height);
// Safe version:
// auto sk_rect = SkRect::MakeLTRB(rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom());Where rect was {{-Inf, -Inf}, {+Inf, +Inf}} and sk_rect ended up being {{-Inf, -Inf}, {NaN, NaN}} (using the impeller representation of rects), because -Inf + +Inf == NaN.
/cc @flar who is looking at geometry
/cc @bdero @chinmaygarde - this makes me question a little whether Rect::MakeMaximum in Impeller should be returning an infinitely sized rect or the same as the engine's concept of a "giant" rect, but that's a different and probably less serious issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.team-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team