This repository was archived by the owner on Feb 25, 2025. It is now read-only.
fix the bounds of nested save layers with a mix of clips and transforms#31437
Merged
flar merged 1 commit intoflutter:mainfrom Feb 13, 2022
Merged
fix the bounds of nested save layers with a mix of clips and transforms#31437flar merged 1 commit intoflutter:mainfrom
flar merged 1 commit intoflutter:mainfrom
Conversation
Member
|
How hard would it be to backport this to the 2.10 branch here https://github.com/flutter/engine/commits/flutter-2.8-candidate.16 ? (Ignore that the branch name says 2.8 in it, it's really the 2.10 branch.) |
zanderso
approved these changes
Feb 13, 2022
Contributor
Author
It isn't a clean cherry-pick, but the changes are simple. Should I create a PR? I created #31440 as a proof of concept for cherry-picking. |
Member
Perfect. The luci-engine check is red, but the tree is actually green (/cc @godofredoc), so feel free to land this whenever you're ready. |
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Feb 13, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes dnfield/flutter_svg#661
(Note that the first example in that issue was the only issue that I was able to see a problem on, the other 3 issues added as github comments don't seem to fail for me. But, this fix does fix that first example.)
The problem causing the SVG to not display was the fact that we were getting the bounds of nested save/saveLayer calls wrong. At some point I decided to accumulate the bounds of the layers into their own accumulators and then transforming and clipping them when I accumulated those bounds into the outer layer's bounds in the restore() call. Unfortunately, this doesn't work because the clip is in device pixels (actually in "the pixel coordinate space in which the DL is rendered" to be specific) and so when I reset the matrix and not the clip I would end up with mismatched a clip and matrix that didn't agree on the coordinate space in which they applied.
I fixed this by 2 essential changes:
LayerDatasubclasses in favor of a single class that just remembers the needed information and lets therestore()call do the work in one location that is easier to understand and maintain.