Skip to content

MT-preparation 3/4: paint servers

PBS requested to merge pbs3141/inkscape:mt-preparation-paintservers into master

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:

  1. As mentioned in !4609 (merged), it's an obstruction to asynchronous rendering.

  2. 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 to SPPaintServer, 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.

Edited by PBS

Merge request reports