Skip to content

Implement optimized blending modes for Color Smudge paintop

The patch implements several things:

  1. Adds U16 versions of Over and AlphaDarken composite ops. The basic memory access is taken from Mathias Wein's (!584 (closed)) patch

  2. Adds implementation of Copy composite op for U8, U16 and F32 color spaces. This composite op is used a lot in colorsmudge.

  3. The patch makes F32 and U16 (and U8 for "copy") composite ops to reuse the same codebase.

In comparison to !584 (closed) this patch has two things "not implemented yet":

  1. No optimization for alpha-locked state
  2. No optimization for separate read/demangle of the alpha channel value

Both these optimizations can be added later.

Benchmarking results for 200px auto brush:

old (ms) new (ms) speed increase (%)
Dulling, Smear Alpha 8212 6616 19.43%
Dulling, No Smear Alpha 6983 6600 5.48%
Smearing, Smear Alpha 6658 4875 26.78%
Smearing, No Smear Alpha 5604 4869 13.12%

Test Plan

  1. Try to paint with normal brush in "wash" mode with low opacity/flow values. There should be no artifacts visible

  2. Try to paint with ColorSmudge brush in the following modes:

    • Smear Alpha is on/off

    • Inherit Alpha is on/off

    • Any selection is on/off

    • Some color channels of the layer are off

Test Packages

  1. DK1

Ref T12987

Edited by Amy spark

Merge request reports