aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@digia.com>2013-04-30 08:29:59 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-03 16:29:01 +0200
commite1a8762e9c39133cb3d1d9c2cdf51003f75d6c05 (patch)
treed97dd3334726ef397b84117f6d1d5cddb2647ca6 /src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
parent030ebca1f74dfb6f858bc4e2c594bd2075ca189c (diff)
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>
Diffstat (limited to 'src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp')
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
index e917623cb0..237bd61c1b 100644
--- a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
+++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
@@ -75,7 +75,7 @@ namespace {
shadowPainter.end();
if (blur > 0)
- qt_image_boxblur(shadowImage, blur/2, true);
+ qt_image_boxblur(shadowImage, qMax(1, qRound(blur / 2)), true);
// blacken the image with shadow color...
shadowPainter.begin(&shadowImage);