Draft: Implement region-based image compositing optimizations

This is a work-in-progress branch for the region-based image compositing optimizations. This optimizations will allow Krita to skip compositing empty tiles. It will make layer composting operations much faster on huge images with sparse data. What will be optimized:

  1. Layer merge operations will skip empty tiles
  2. Filter application operations will skip empty tiles
  3. Exact Bounds calculation will skip empty tiles (making thumbnails generation significantly faster)

Still TODO:

  1. Fix KisPainterTest::testRegionBasedOptimizations for the case when Wraparound mode is enabled with the selection present (currently fails).

  2. Make sure KisPainterTest::testRegionBasedOptimizations is not so slow (by splitting into multiple tests)

  3. Add a big (multiple tiles) offset to KisPainterTest::testRegionBasedOptimizations

  4. Call KisPainter::setAllowRegionOptimizations() in all the composition-related code

  5. Add an exactBounds/region() unittest for group layers, filter layers, filter masks and transparency masks.

  6. Add a reference unittest for filters that should support region-based processing

  7. Make a list of filters to ports. Theoretically, it should be all filters that have needsTransparentPixels() set to false, though I'm not sure.

  8. Modify KisSequentialIterator so we could avoid recreation of the iterator for every region's rect.

  9. Implement a global switch for the new optimizations. KisPainter::globalRegionOptimizationsEnabled should read this values on Krita start.

  10. Implement/document an action that purges all empty tiles from the image.

Merge request reports

Loading