Diffusion Krita 477012cd190c

Refactor out using global resources singletons in KisPaintOpSettings

Authored by dkazakov on Feb 21 2020, 10:04 AM.

Description

Refactor out using global resources singletons in KisPaintOpSettings

We cannot access global resource system while rendering the stroke in
a worker thread. Therefore, we should prepare all the resources in
advance, in GUI-thread, wrap them into a "server-like" storage and
then pass to the paintop itself

The patch does the following changes:

  1. KisPaintOpSettings now stores an internal link to "resources interface". Whenever the settings object wants to fetch a resource, e.g. in KisBrushBasedPaintOpSettings::paintOpSize(), it asks the resource interface about it.
  1. Before starting a stroke KisResourcesSnapshot does the following preparations (via KisPaintOpPreset::createLocalResourcesSnapshot()):
    1. Asks the paintop's factory about all the needed resources via (static) call to prepareResources().
    2. Wraps all these resources into KisLocalStrokeResources "fake" object.
    3. Sets this "fake" object as a resources source for KisPaintOpSettings object. Therefore, no global resources system will be accessed during the execution of the stroke.
  1. KoResource::load() and KoResource::loadFromDevice() now should also accept the resources interface. Obviously, the resources source for for KisPaintOpPreset should be set up right from the construction.

Details

Committed
dkazakovFeb 21 2020, 10:50 AM
Parents
R37:77f6ccc324e8: Add cpp-quirks for future C++ standards
Branches
Unknown
Tags
Unknown
References
refs/keep-around/477012cd190ceb3d7c233ad09e9389d09478df31