MT preparation 2/4: patterns
This MR is part of a series. See !4556 (merged) for the roadmap.
This MR makes some significant changes to how patterns are handled, both at the level of the SPObject
tree and the DrawingItem
tree. In a nutshell,
-
In the object tree,
SPPattern
saw a redesign to allow it to create persistent display tree, rather than continually building and tearing it down while rendering. The rest of the changes were needed to make this work rock-solidly as the document updates, even for documents with multiply-nested patterns such as nested-pattern.svg and nested-chained-pattern.svg. It should be possible to play arbitrary games with the XML editor without crashing, missing updates, or incorrect rendering. Doing so eliminates a multithreading roadblock and a layering violation: the display tree should not communicate with the object tree while rendering! -
In the display tree,
DrawingPattern
also saw a near-total rewrite to fix #1018 (closed). The reason this fix crept into the MR was because the previous commit brought more opportunities for caching, but patterns live outside the cache system, so it also brought higher memory usage on certain very heavy documents. So this was required to make up for it. Patterns also don't seem to disappear or go black any more, but I wouldn't be surprised if it can still happen. (Demo video: https://i.imgur.com/iTSZEKZ.mp4.)
See the two commit descriptions for more technical details.
Fixes #927 (closed) #1018 (closed).