Skip to content

Fix rendering of vector masks applied to group shapes

This MR is a bugfix for https://bugs.kde.org/show_bug.cgi?id=392242

The patch does multiple things:

  1. Refactors KoShapeManager::paint() to use KisForest implementation to render shapes hierarchy. It is needed because we need to be able only a part of the shapes, and their parents might have filtering or masks. Theoretically, it is possible to implement this algorithm without KisForest, but it this case populateRenderSubtree(), buildRenderTree() and renderShapes() will be merged into a single function (or some counter-intuitive templated strategy), which would make the code hard to debug and maintain.

  2. KoViewConverter is gone! Gone! You hear it?! It is gone!!! No more KoViewConverter in any rendering! :) Well, it is still used in the tools, but we can live with it for now. The main point, there is no ugly hacks in KoShape::absoluteTransformation() to correct shape's offset to let view scaling transform be applied after the shape. Now view tranform in applied before the shapes, right in KisShapeLayerCanvas (or the like).

The code touches a lot of code, so some testing is needed. See "Test Plan" section.

Things that were deprecated:

  • SVG-filtering rendering code was removed. It used an ugly hack to let it work on groups. It couldn't be kept after refactoring. When we implement it correctly, it should be just placed into renderShapes().

  • some features of ODF text and raster-based vector patterns might have become broken. But we have no way to test that :(

Known Bugs

  1. Rotation of Gamut Masks doesn't work correctly. Otherwise, if rotation is set to 0deg, Gamut Masks should work perfectly

Test Plan

Prebuilt Windows package for testing: https://yadi.sk/d/tU3K7P4P2LZ_cw

  1. Test the following tool to work. Make sure control handles are highlighted in proper places and cursor changes when needed.
  • Bezier Path Tool
  • Pencil Tool
  • Calligraphy Tool
  • Bezier Selection Tool
  • Shape Editing Tool
  • Shape Selection Tool (try editing gradient as well)
  1. Test if Text is still rendered correctly

  2. Test if snapping snaps to shape nodes

  3. Test if Reference Tool (and just references) work correctly. Especially with previously saved files.

  4. Test Gamut Masks: rendering and editing.

  5. Test Vector Object Collection to be loaded correctly (its code has changed) and it check if D&D from the docker works as expected.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Dmitry Kazakov

Merge request reports

Loading