Skip to content

WIP: Fix deform brush by using precise paint device wrapper.

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

This is an attempt at fixing BUG 290383.

This solution assumes the main problem is rounding errors. Therefore, we're using the KisPrecisePaintDeviceWrapper class that was designed to solve rounding error issues in the color smudge brush. It somewhat works.

Remaining issues:

  • Is m_dev still relevant?
  • To reproduce the 'original source device' feature, I have to turn off 'resetRegion'. Is this correct? Is the functionality in DeformBrush::paintMask still relevant?
  • The brush is now a lot slower :|
  • Is this the correct place to put this, or should it be in DeformBrush::paintMask?
  • This works for the move mode, but does funny things for shrink/rotate/etc. The class implies that for the move mode doesn't draw until the second dab. What can I do to ensure the other modes get the appropriate data? Is it related to the bounding box I am choosing to use here?
  • Do you think the filter and clone brush benefit from preciseDeviceWrapper as well?
  • Should we maybe port this engine over to KisBrushBasedPaintOp? Because it's just a circle? (Maybe more of a long-term project)
  • mirrored masks are not handled yet. There's code for that in kiscolorsmudgeop, but my earlier attempts at getting this to work just resulted in nothing happening. This is probably just because I don't understand the precisepaintdevicewrapper fully yet.

Now with more pictures:

krita_4_2_deform_issue

krita_fixed_deform_issue

Test Plan

Try to first reproduce the bug in question in regular krita. As well, try using a deform brush repeatedly on an 8bit drawing without opacity. Observe how the alpha of the device just goes more and more transparent regardless of whether there was transparency in the original image. Furthermore, try to observe the difference in behaviour when using different blending modes. Copy mode for example softly smudges transparent edges, while normal mode doesn't try to change the border. Similarly, try the different modes and options in general.

Now you've got a good idea how this brush is supossed to behave, apply this patch and see if you can reproduce the behaviours.

@ivany, while the majority of this patch is something @dkazakov should comment on, you were the last person to try and fix this bug, so maybe you can try to test it for issues as well?

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