Description
I'm rendering document pages, which seems to be very performance intensive. I'm not entirely sure why. The volume of content in the document pages isn't dramatic. Nonetheless, the time to push the display list to the engine takes many frames.
Putting aside the time to push the initial display list, is there a way to cache a document page's display list in the engine, such that the page can be scaled up/down, without sending over another display list? The page content doesn't change after the initial render, only the ancestor transformations, so I would hope that there's a way to avoid any additional RenderObject
work, but I haven't found such a path.
I tried wrapping each page with a RepaintBoundary
, but this seems to yield very strange behavior when scaling up/down. Does the display list within a RepaintBoundary
apply ancestor transformations up front, and then retain global coordinates? Or does the display list within a RepaintBoundary
retain local coordinates and then play those on top of ancestor transformations in the engine? If the former, that might explain the weird behavior that I'm seeing.
Here are a couple videos that show the RepaintBoundary
problem. In this first video, I have a series of "pages" that I can scroll and scale. The pages changes size as expected, they continue to meet exactly where they should, and the circle in the center grows and shrinks as expected.
pages_without-repaint-boundary.mp4
In this next video, I took the exact same code and added a RepaintBoundary
around a CustomPaint
, which paints the circle at the center of each page. Here's what happens now.
pages_with-repaint-boundary.mp4
These pages are laid out in a custom RenderObject
, so it's possible that I'm screwing something up, but in the absence of a RepaintBoundary
, the children appear with the offset and scale that they should.
So that's a problem that's actively preventing me from using a RepaintBoundary
, but I'm also wondering if there are any other caching strategies that would allow content transformation without regenerating the display list for each page?