Skip to content
  • Ell's avatar
    app: exclude invisible filters from filter-stack graph · e02cb6ad
    Ell authored
    Currently, when a GimpFilter's visibility changes, we rely on its
    various visibility-changed signal handlers to rewire the filter
    node's graph to reflect the change.  This has two main
    disadvantages:
    
      - There's no easy, generic way to toggle a filter's  effect,
        especially one that is not subclassed, since GimpFilter only
        takes care of the case where visibility becomes FALSE, and does
        nothing by itself when it becomes TRUE again.
    
      - While GimpDrawable does handle the visibility => TRUE case, it
        doesn't disconnect the filter's input from its mode and
        (potentially) source nodes when it becomes invisible.  As a
        result, while none of the drawable's graph is processed as part
        of the composition when not visible, the mode and source nodes
        do get invalidated when the filter's input is invalidated, such
        as while painting on a layer below the drawable.  This is
        particularly bad for pass-through groups, since their source
        node can be an arbitrarily complex graph, whose invlidation
        incurs a nontrivial overhead.
    
    Instead, don't touch the filter's node at all when visibility
    changes, and rather have GimpFilterStack remove it from the graph
    entirely when the filter becomes invisible, and re-add it once it
    becomes visible again.  This solves both of the above problems, as
    well as simplifies the code.
    e02cb6ad