Skip to content
  • Ell's avatar
    app: layer mode code shuffling · 71bbd88e
    Ell authored
    Commit 3635cf04 moved the special
    handling of bottom-layer compositing to GimpOperationLayerMode.
    This required giving the op more control over the process()
    function of its subclasses.  As a temporary workaround, the commit
    bypassed the subclasses entirely, using "gimp:layer-mode" for all
    modes.  This is the reckoning :)
    
    Add a process() virtual function to GimpOperationLayerMode, which
    its subclasses should override instead of
    GeglOperationPointComposer3's process() functions.  Reinstate the
    subclasses (by returning the correct op in
    gimp_layer_mode_get_oepration()), and have them override this
    function.
    
    Improve the way gimp_operation_layer_mode_process() dispatches to
    the actual process function, to slightly lower its overhead and
    fix some thread-safety issues.
    
    Remove the "function" field of the layer-mode info array, and have
    gimp_layer_mode_get_function() return the
    GimpOperationLayerMode::process() function of the corresponding
    op's class (caching the result, to keep it cheap.)  This reduces
    redundancy, allows us to make the ops' process() functions private,
    and simplifies SSE dispatching (only used by NORMAL mode,
    currently.)
    
    Move the blend and composite functions of the non-specialized
    layer modes to gimpoperationlayermode-{blend,composite}.[hc],
    respectively, to improve code organization.
    
    Move the SSE2 composite functions to a separate file, so that they
    can be built as part of libapplayermodes_sse2, allowing
    libapplayermodes to be built without SSE2 compiler flags.  This
    allows building GIMP with SSE acceleration enabled, while running
    the resulting binary on a target with no SSE accelration.
    
    Add a "blend_function" field to the layer-mode info array, and use
    it to specify the blend function for the non-specialized modes.
    This replaces the separate switch() statement that we used
    previously.
    
    Remove the "affected_region" field of the layer-mode info array.
    We don't need it anymore, since we can go back to using
    GimpOperationLayerMode's virtual get_affected_region() function.
    
    Last but not least, a bunch of code cleanups and consistency
    adjustments.
    71bbd88e