Made Canvas blur better match the one in HTML 5 Canvas.
authorSamuel Rødal <samuel.rodal@digia.com>
Tue, 30 Apr 2013 06:29:59 +0000 (08:29 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 3 May 2013 14:29:01 +0000 (16:29 +0200)
commite1a8762e9c39133cb3d1d9c2cdf51003f75d6c05
treed97dd3334726ef397b84117f6d1d5cddb2647ca6
parent030ebca1f74dfb6f858bc4e2c594bd2075ca189c
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: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
src/quick/items/context2d/qquickcontext2d.cpp
src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp