Faster display list recording / paint passing.#168019
Faster display list recording / paint passing.#168019jonahwilliams wants to merge 9 commits intoflutter:masterfrom
Conversation
| const Matrix& transform) const { | ||
| return TRect::MakeOriginSize( | ||
| GetOrigin() + TPoint<float>(transform.m[12], transform.m[13]), // | ||
| GetSize().Scale(transform.m[0], transform.m[5]) // |
There was a problem hiding this comment.
This is not correct. You have to scale all 4 points.
Also, if there is a negative scale it can mess things up - your rect will be upside down.
There was a problem hiding this comment.
Update the unit tests with lots of cases of rects at origin or not at origin, various sizes, and various scales and translates and make sure the answer is the same as the full transform.
| matrix_ = matrix_ * DlMatrix::MakeSkew(skx, sky); | ||
| } | ||
| void rotate(DlRadians angle) { | ||
| is_translate_scale_ = false; |
There was a problem hiding this comment.
90 degree rotations might be common and they can be optimized as well, but it isn't as simple as the new method. Also, unfortunately, rotate(radians) is hard to detect a quadrant rotation because the quadrant angles are all transcendental by being related to pi.
| return false; | ||
| impeller::Rect dl_intersected = dl_mapped.FastIntersection(cull_rect_); | ||
| *mapped = dl_intersected; | ||
| return true; |
| *mapped = dl_intersected; | ||
| return true; | ||
| } | ||
| return false; |
There was a problem hiding this comment.
You leave the mapped value undefined here. Set it to empty.
|
The SkMatrix class has a classifier field that tells them if it is just a scale/translate so they can do more optimal work. I originally developed a similar DlTransform class (see below) that also classified its state for the same purpose, but ditched that in favor of just working on the Impeller classes. Unfortunately, when I looked at the performance of the impeller::Matrix class it seemed as if it could do the work of the "case-optimized" transform classes faster by not checking and just letting the compiler do its magic, but it's been a while since I've worked on that. See https://github.com/flar/engine/blob/dl-geometry-classes/display_list/geometry/dl_transform.h and https://github.com/flar/engine/blob/dl-geometry-classes/display_list/geometry/dl_transform.cc |
Split off of #168019 Worst case allocation performance for dl is fairly bad as we end up copying the data many more times than something like an STL vector would. At the cost of more memory usage, we can improve the case where the display list grows quite large.
Split off of flutter#168019 Worst case allocation performance for dl is fairly bad as we end up copying the data many more times than something like an STL vector would. At the cost of more memory usage, we can improve the case where the display list grows quite large.
Split off of flutter#168019 Worst case allocation performance for dl is fairly bad as we end up copying the data many more times than something like an STL vector would. At the cost of more memory usage, we can improve the case where the display list grows quite large.
Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.
List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.