Commit e1a8762e authored by Samuel Rødal's avatar Samuel Rødal Committed by The Qt Project
Browse files

Made Canvas blur better match the one in HTML 5 Canvas.


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>
parent 030ebca1
No related merge requests found
Showing with 70 additions and 34 deletions
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment