Smudge optimizations

Dmitry Kazakov dimula73 at gmail.com
Thu Mar 11 19:28:11 CET 2010


For brushes with the size >= 64, bitBlt'ing at the data manager level could
help as color spaces coincide. This feature is in my todo list, but i have
much university work atm.

On Thu, Mar 11, 2010 at 7:00 PM, LukasT.dev at gmail.com <> wrote:

> Hello,
>
> I'm working on optimizing the smudge.
>
> In smudge we have these buffers:
> dab (the brush)
> device (we copy pixels from the actual layer)
> m_srcdev (we decrease opacity here but we first copy pixels from layer
> there)
> dabAsSelection - copy of dab so that bitBlt works with selection saved in
> fixed
> m_target - KisPaintDevice which will be bitBlt on layer
>
> Cyrille proposed to remove the dabAsSelection, because in valgrind it
> showed
> some performance problems.
>
> So I created KisFixedPainter so that I can composite KisPaintDevice on
> KisFixedDevice. This is needed when coping pixels from device to m_srcdev.
> Because I wanted to have m_srcdev as fixed device.
>
> I also made this method
> void KisPainter::bltFixed(qint32 dx, qint32 dy,
>                          const KisFixedPaintDeviceSP srcDev,
>                          const KisFixedPaintDeviceSP selection,
>                          qint32 sx, qint32 sy,
>                          qint32 sw, qint32 sh)
>
> so that we can bitBlt with fixed device as selection. This way we don't
> have to copy fixed device into KisSelection so that we can bitBlt with
> selection saved in fixed device on KisPaintDevice.
>
> Problem is that m_srcdev has to be KisPaintDevice in the end. It has to
> grow
> according pressure.
>
> You can resize fixed device but you invalidate the data and you actually
> need
> them for next iteration. I also tried to allocate double size of the buffer
> because I supposed that the device would grow maximally twice. But that is
> not
> good assumption because with e.g. dyna tool the paint device starts with
> size
> 1 and grows to 10, so 10 times in that case. You can't guess maximum scale
> size, it is dynamic so we need to use KisPaintDevice anyway for m_srcdev.
>
> Now I can't use KisPainter::bltFixed as the m_srcdev is not fixed anymore.
> The solution would be to code bitBlt with KisFixedDevice as selection.
>
> BitBlt on KisPaintDevice with source KisPaintDevice and selection
> KisFixedDevice is quite crazy to code. Let's take a look at bitBlt function
> and you will get the idea.
>
> So what do you suggest to do ?
> Should I start to code bitBlt with fixed selection or have you got better
> idea?
>
>
>
>
>
>
>
> Here is the patch
> http://lukast.mediablog.sk/patches/smudgeop.patch
> _______________________________________________
> kimageshop mailing list
> kimageshop at kde.org
> https://mail.kde.org/mailman/listinfo/kimageshop
>



-- 
Dmitry Kazakov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kimageshop/attachments/20100311/92aa5d49/attachment.htm 


More information about the kimageshop mailing list