• Samuel Rødal's avatar
    Made Canvas blur better match the one in HTML 5 Canvas. · e1a8762e
    Samuel Rødal authored
    
    Fixed blur being too faint by fixing the weight to correctly match the
    amount of pixels being sampled based on the blur radius, and by not
    multiplying and flooring to int inside the sampling loop which leads to
    excessive rounding down errors.
    
    The "half" value in the previous implementation was also wrong due to
    using integer division instead of floating point division, which caused
    the blur being slightly offset down and to the right.
    
    By not calling scanLine() and constScanline() repeatedly and by only
    applying the weight once in the single-weight case we can also gain a
    slight performance improvement.
    
    Also, make sure blur radii below 2 don't get floored to 0.
    
    Change-Id: Ibe15d0f51c919594b168923485c051d21f8d7822
    Reviewed-by: default avatarMitch Curtis <mitch.curtis@digia.com>
    Reviewed-by: default avatarGunnar Sletta <gunnar.sletta@digia.com>
    e1a8762e