Skip to content

Ignore global alpha lock when in erase mode

Enabling alpha lock and erase mode simultaneously usually disregards the former. MyPaint brushes are an exception, they do absolutely nothing when both of those are active. This is due to them not using the regular Erase blend mode, but instead have their own "Normal and Erase" mode they always use.

This patch puts the logic into KisResourcesSnapshot: if erase mode is enabled, it doesn't pull the value of global alpha lock. This doesn't cause a change in behavior for brushes that already worked properly, since they ignored the alpha lock through other means already, but fixes MyPaint brushes in that regard.

Not sure if this is the proper place for this change, but it doesn't seem to break anything and represents the underlying logic pretty well: erase mode overrides alpha lock.

Test Plan

Have something you can erase. Pick a brush, enable both eraser mode and global alpha lock.

Before applying this patch: MyPaint brushes do nothing. Other brushes erase.

After applying this patch: all brushes erase, including MyPaint brushes.

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