MT-preparation 3/4: paint servers
This MR is part of a series. See !4556 (merged) for the roadmap.
This is a small and relatively safe refactoring of paint servers. It doesn't aim to change the rendering strategy in any way; it just affects how data is pushed around internally. From the commit message,
Add DrawingPaintServer class
This commit adds a class hierarchy for storing paint server information
in the display tree. It allows the rendering code for patterns to be
moved out of SPPaintServer and into the /display subdirectory, and allows
patterns to be rendered without accessing the corresponding SPPaintServer.
Smaller changes:
* Fix indentation in display/CMakeLists.txt.
* Add a defensive-coding null check to NRStyle.
Basically, the current rendering code calls directly into SPPaintServer
to create patterns for gradients, etc. This is bad for several reasons:
-
As mentioned in !4609 (merged), it's an obstruction to asynchronous rendering.
-
Looking to the future, the rendering code in
SPPaintServer
(which shouldn't be there) assumes a Cairo backend. It is impossible to add a new OpenGL backend without adding OpenGL code toSPPaintServer
, which we definitely don't want to do.
So this MR simply has SPPaintServer
bundle up the relevant data into a DrawingPaintServer
that it passes to the display tree. This is then used when rendering instead of SPPaintServer
, solving 1, and different rendering backends can easily be added, solving 2.