[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Re: Consecutive Convolutions
From:       Dmitry Kazakov <dimula73 () gmail ! com>
Date:       2009-12-27 18:54:05
Message-ID: ae32c1ef0912271054h1ce9e56y170d5daa4d4a444a () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I'll commit a workaround tonight.

Just create a blur mask and paint on the layer with a brush with a diameter
smaller than 2*width of a kernel.
The first applyMatrix will return an empty paintDevice, and the second
applyMatrix will crash because of empty interm->extent().


On Sun, Dec 27, 2009 at 9:35 PM, Ed . <schumifer@hotmail.com> wrote:

> Could you elaborate what you are doing to crash Krita when painting on the
> mask?
> 
> ------------------------------
> Date: Sun, 27 Dec 2009 14:08:02 +0300
> 
> Subject: Re: Consecutive Convolutions
> From: dimula73@gmail.com
> To: kimageshop@kde.org
> 
> Well, i seem to have fixed this. Please update.
> 
> There are some crashes when you paint on the mask, i'm investigating this.
> 
> 
> A couple of comments about the pacth:
> 1) There is no need to make a copy of a source device as convolution will
> do this for you one more time. I mean first line should be:
> KisPaintDeviceSP interm = new KisPaintDevice(src->colorSpace());
> 
> 2) Shared pointers shouldn't be delete'ed. This may cause a crash =)
> 
> Final working version of the 'if':
> 
> 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.applyMatrix(kernelHoriz, src, srcTopLeft, srcTopLeft,
> size, BORDER_REPEAT);
> 
> KisConvolutionPainter verticalPainter(dst, dstInfo.selection());
> verticalPainter.applyMatrix(kernelVertical, interm, srcTopLeft,
> dstTopLeft, size, BORDER_REPEAT);
> 
> }
> 
> 
> --
> Dmitry Kazakov
> 
> ------------------------------
> Windows Live Hotmail: Your friends can get your Facebook updates, right
> from Hotmail ®.<http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-ac \
> tion/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009>
>  
> _______________________________________________
> kimageshop mailing list
> kimageshop@kde.org
> https://mail.kde.org/mailman/listinfo/kimageshop
> 
> 


-- 
Dmitry Kazakov


[Attachment #5 (text/html)]

I&#39;ll commit a workaround tonight.<br><br>Just create a blur mask and paint on the \
layer with a brush with a diameter smaller than 2*width of a kernel.<br>The first \
applyMatrix will return an empty paintDevice, and the second applyMatrix will crash \
because of empty interm-&gt;extent().<br> <br><br><div class="gmail_quote">On Sun, \
Dec 27, 2009 at 9:35 PM, Ed . <span dir="ltr">&lt;<a \
href="mailto:schumifer@hotmail.com">schumifer@hotmail.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




<div>
Could you elaborate what you are doing to crash Krita when painting on the \
mask?<br><br><hr>Date: Sun, 27 Dec 2009 14:08:02 +0300<div class="im"><br>Subject: \
Re: Consecutive Convolutions<br>From: <a href="mailto:dimula73@gmail.com" \
                target="_blank">dimula73@gmail.com</a><br>
To: <a href="mailto:kimageshop@kde.org" \
target="_blank">kimageshop@kde.org</a><br><br></div><div><div></div><div \
class="h5">Well, i seem to have fixed this. Please update.<br><br>There are some \
crashes when you paint on the mask, i&#39;m investigating this.<br> <br><br>A couple \
of comments about the pacth:<br>1) There is no need to make a copy of a source device \
as convolution will do this for you one more time. I mean first line should be:<br> \
KisPaintDeviceSP interm = new KisPaintDevice(src-&gt;colorSpace());<br><br>2) Shared \
pointers shouldn&#39;t be delete&#39;ed. This may cause a crash =)<br><br \
clear="all">Final working version of the &#39;if&#39;:<br><br>

if ( (horizontalRadius &gt; 0) &amp;&amp; (verticalRadius &gt; 0) )<br>       {<br>   \
KisPaintDeviceSP interm = new KisPaintDevice(src-&gt;colorSpace());<br><br>           \
KisConvolutionKernelSP kernelHoriz = KisConvolutionKernel::fromMatrix(horizGaussian, \
0, horizGaussian.sum());<br>

               KisConvolutionKernelSP kernelVertical = \
KisConvolutionKernel::fromMatrix(verticalGaussian, 0, \
verticalGaussian.sum());<br><br>               KisConvolutionPainter \
horizPainter(interm, dstInfo.selection());<br>               \
horizPainter.applyMatrix(kernelHoriz, src, srcTopLeft, srcTopLeft, size, \
BORDER_REPEAT);<br>

<br>               KisConvolutionPainter verticalPainter(dst, \
dstInfo.selection());<br>               verticalPainter.applyMatrix(kernelVertical, \
interm, srcTopLeft, dstTopLeft, size, BORDER_REPEAT);<br><br>       }<br><br><br>-- \
<br>Dmitry Kazakov<br>  <br></div></div><div class="hm"><hr>Windows Live Hotmail:  <a \
href="http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009" \
target="_blank">Your friends can get your Facebook updates, right from Hotmail \
®.</a></div> </div>
<br>_______________________________________________<br>
kimageshop mailing list<br>
<a href="mailto:kimageshop@kde.org">kimageshop@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kimageshop" \
target="_blank">https://mail.kde.org/mailman/listinfo/kimageshop</a><br> \
<br></blockquote></div><br><br clear="all"><br>-- <br>Dmitry Kazakov<br>



_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic