Skip to content

452172: Fix painting on selection masks with various blending modes

This should allow painting on masks (such as transparency masks) with all blending modes available for Grayscale/Alpha, and also correctly display which modes are available.

Basically, all the prerequisites were there already, but actually using them failed in a few key places. It happened to work with Multiply for example, because the Alpha color space implements this composite op, but it has nothing to do with painting on a mask in multiply mode, since compositing paint strokes actually happens in Grayscale/Alpha.

I'm not sure if this is the most elegant solution, but just adding a ton of dummy ops to Alpha color space clearly felt like a hack, and with this solution, it also resolves a performance FIXME in KoColorSpace::bitBlt(), if used correctly. See commit messages for details.

Apologies for the long list of changes, I thought it's a good occasion to resolve another TODO and rename a KisPainter function touched here, turned out to be used in a lot of places...also, not even ccache is going to save you from a (nearly) full recompile.

Test Plan

Basically follow the instructions in BUG:452172

All blending modes of Grayscale/Alpha should work as expected to paint on masks. Also pay attention that the blending mode list correctly marks unavailable blending modes, and that the combo-box does not unexpectedly jump back to "Normal" anymore.

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.

Merge request reports