Gaussian filter bounds problems

Dmitry Kazakov dimula73 at gmail.com
Mon May 3 08:28:06 CEST 2010


Hi, Edward!

I tried to reproduce the bug with png image bounds today and i failed.
Everything seems to work with Blur and Gaussian Blur filters added as masks
and adjustment layers. Could you describe how to reproduce it here?


Btw, i found a bug in Gaussian Blur filter. Try to apply it to an image that
is bigger than 512x512 pixels. You get a border effect.
The cause is this code, i think:
 if ( (horizontalRadius > 0) && (verticalRadius > 0) )
    {
        KisPaintDeviceSP interm = new KisPaintDevice(src->colorSpace());

        KisConvolutionKernelSP kernelHoriz =
KisConvolutionKernel::fromMatrix(horizGaussian, 0, horizGaussian.sum());
        KisConvolutionKernelSP kernelVertical =
KisConvolutionKernel::fromMatrix(verticalGaussian, 0,
verticalGaussian.sum());

        KisConvolutionPainter horizPainter(interm, dstInfo.selection());
        horizPainter.setChannelFlags(channelFlags);
        horizPainter.setProgress(progressUpdater);
        horizPainter.applyMatrix(kernelHoriz, src, srcTopLeft, srcTopLeft,
size, BORDER_REPEAT);

        KisConvolutionPainter verticalPainter(dst, dstInfo.selection());
        verticalPainter.setChannelFlags(channelFlags);
        verticalPainter.setProgress(progressUpdater);
        verticalPainter.applyMatrix(kernelVertical, interm, srcTopLeft,
dstTopLeft, size, BORDER_REPEAT);
    }

The problem is, when you convolve the second time, there is no needRect
prepared for the convolution. src device has this additional data (it is
prepared by walkers), while interm doesn't. I see the only way out in
bitBlt'ing src into interm, but this will be very inefficient. Or writing a
special RepeatIteratorFactory that might be too complex task...



-- 
Dmitry Kazakov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kimageshop/attachments/20100503/6086761d/attachment.htm 


More information about the kimageshop mailing list