• Dmitry Kazakov's avatar
    Fix delays in the end of Instant Preview rendering stroke · b5c33311
    Dmitry Kazakov authored
    Needs your testing!
    
    Test Plan:
    
    1) Paint with complex brushes on Float32 images
    2) Try painting many repetitive strokes, there should be no
       flockering and no delays.
    3) Try cancel your srokes before they are finished with Esc key.
       Please note that the most dangerous moment is when Krita writes
       "Updating..." right before background stroke calculation is
       finished. Try pressing exactly at this moment! :)
    
    Technical Details:
    
    There was a short delay in the end of every Instant Preview
    regeneration stroke. It was mostly seen on bigger canvases and
    Float32-bitdepth mode.
    
    The cause of this delay was the "update resume" stroke that
    tried to upload the 100%-zoom image data to the canvas. Sometimes
    such uploading could take up to 1.5 seconds, which could interfere
    into the painter's workflow.
    
    This patch does multiple things to mitigate this problem:
    
    1) KisSuspendProjectionUpdatesStrokeStrategy is now suspendable
       (again). It means that Krita will suspend the uploading process
       if the user desides to paint further instead of waiting for the
       background rendering to complete. This is the main part of this
       patch.
    
    2) On resuming Krita will not upload the entire image to the canvas,
       but only a changed part. This is achieved by collecting dirty
       requests in KisImage::enableUIUpdates(). This method itself doesn't
       solve the initial problem, but it makes uploading a bit more efficient.
    
    3) While the resume stroke is suspended, KisOpenGLCanvas2 blocks all the
       synchronizations of tiles' mipmaps. It means that normal lodN strokes
       will run with the mipmaps blocked. It is a bit dangerous approach, but
       it works until KisSuspendProjectionUpdatesStrokeStrategy is the only
       user of sigRequestLodPlanesSyncBlocked() signal.
    
    CC:kimageshop@kde.org
    BUG:361448
    Fixes T2145
    b5c33311