summaryrefslogtreecommitdiffstats
path: root/kdefx
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-25 21:13:21 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-25 21:13:21 +0000
commit2944cdf050c47b9a048b7f0d19741fac23aa77c3 (patch)
treea60a52ad7403edadb2839096c9530b1fc777ba47 /kdefx
parenteab043fd0dea1332165e5f57f4d7fd8ed0422398 (diff)
downloadtdelibs-2944cdf050c47b9a048b7f0d19741fac23aa77c3.tar.gz
tdelibs-2944cdf050c47b9a048b7f0d19741fac23aa77c3.zip
Fix KImageEffect blur convolution
Add blur ability to krootpixmap git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1249535 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdefx')
-rw-r--r--kdefx/kimageeffect.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/kdefx/kimageeffect.cpp b/kdefx/kimageeffect.cpp
index 8fac1f5cb..d2955403a 100644
--- a/kdefx/kimageeffect.cpp
+++ b/kdefx/kimageeffect.cpp
@@ -4316,6 +4316,7 @@ TQImage KImageEffect::blur(TQImage &src, double radius, double sigma)
dest.create(src.width(), src.height(), 32);
+ // Horizontal convolution
scanline = (unsigned int *)malloc(sizeof(unsigned int)*src.height());
temp = (unsigned int *)malloc(sizeof(unsigned int)*src.height());
for(y=0; y < src.height(); ++y){
@@ -4324,14 +4325,17 @@ TQImage KImageEffect::blur(TQImage &src, double radius, double sigma)
blurScanLine(kernel, width, p, q, src.width());
}
- unsigned int **srcTable = (unsigned int **)src.jumpTable();
+ TQImage partial = dest;
+
+ // Vertical convolution
+ unsigned int **srcTable = (unsigned int **)partial.jumpTable();
unsigned int **destTable = (unsigned int **)dest.jumpTable();
- for(x=0; x < src.width(); ++x){
- for(y=0; y < src.height(); ++y){
+ for(x=0; x < partial.width(); ++x){
+ for(y=0; y < partial.height(); ++y){
scanline[y] = srcTable[y][x];
}
- blurScanLine(kernel, width, scanline, temp, src.height());
- for(y=0; y < src.height(); ++y){
+ blurScanLine(kernel, width, scanline, temp, partial.height());
+ for(y=0; y < partial.height(); ++y){
destTable[y][x] = temp[y];
}
}