Skip to content

Fix deform brush by making KoColorMixOp handle non-255 weights.

Wolthera van Hövell requested to merge wolthera/BUG-290383-colormixopfix into master

This fixes the bug where this brush slowly outputs everything to transparent.

The bug was caused by the fact that to sample the input pixels, the crossdevice color picker was used, which in turn got access to subpixel data by utilizing the randomsubaccessor, which was getting that data by mixing neighbouring pixels via the KoColorMixOp. However, the randomsubaccessor isn't able to generate perfect sums-to-255 weights every single time, meaning transparency was added.

This commit fixes that by passing a sum of weights to the KoColorMixOp that only defaults to 255.

Special thanks to Dmitry for figuring this out.

BUG:290383

I chose to just fix the colorop in general. I looked at the 17 places where it is used, it does not seem like we were using it anywhere where we wanted to ADD transparency or something like that. In fact, you could argue I ought to just go through all those 17 places and remove the extra code associated with fixing the weights to sum to 255 perfectly (Unless it's used as a multiplier for a 0 to 1 range).

Test Plan

Go into the deform brush and mess with it for about about a minute.

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 Wolthera van Hövell

Merge request reports