This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think you want to do
fillType = ui.PathFillType.nonZero
(otherwise it won't send the value over to the WASM side; see line 37).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.
Ah, nvm. You explained it in the issue.
_skPath.reset()
does that already.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.
That was intentional as that's what the WASM side defaults it to (perhaps more future proof to set it as well).
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.
If this is implementing ui.Path.reset(), then it should not modify the winding rule. Instead of hard-coding the rule to nonZero, it should reset the WASM side to the current local value.
Uh oh!
There was an error while loading. Please reload this page.
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.
The underlying call to SkPath::reset does this: https://github.com/google/skia/blob/1b89eb742a66257cd780f119c537e833f4554f53/src/core/SkPath.cpp#L163
The stored _fillType needs to be synced with that or further rendering can use the wrong fillType as the CkPath believes its stored _fillType is still set on the backing path. This is the behavior we're seeing, where paths with evenOdd will start using nonZero after calling reset and cannot be set back to evenOdd without first changing them to nonZero.
Setting it to nonZero simply does the equivalent of what Skia is doing so that stored value is in sync. The alternative, more future proof way to do this would be to query the fill rule from _skPath and sync the value stored in CkPath that way. Unless the main flutter engine expects a ui.path.reset to force the fillType/Rule to some other value.
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.
Ignore my previous comment, I was looking at an old version of the sources (I had been investigating an old bug) and what I was reading implied that the fillType was not supposed to be changed on a reset(), but now I see that this is the correct behavior.