are selections part of kispaintdevice or aren't they?

Boudewijn Rempt boud at valdyas.org
Thu Oct 4 22:26:40 CEST 2007


That's the question...

Right now they are, but that gives a problem with the following bit of code 
from KisFilterMask, especially when filters take the selection from the paint 
device during KisFilter::process()

void KisFilterMask::apply( KisPaintDeviceSP projection, const QRect & rc ) 
const
{
    Q_ASSERT( m_d->filterConfig );
    if (!m_d->filterConfig) return;

    selection()->updateProjection();

    // XXX: This is actually a problem when we're running multithreaded, so we 
need to make
    // selection a paramenter of KisFilter::process
    KisSelectionSP oldSelection = 0;
    if (projection->hasSelection())
        oldSelection = projection->selection();

    projection->setSelection( selection() );

    KisFilterSP filter = KisFilterRegistry::instance()->value( 
m_d->filterConfig->name() );
    if (!filter) {
        kWarning() << "Could not retrieve filter with name " <<  
m_d->filterConfig->name();
        return;
    }

    filter->process( projection, rc, m_d->filterConfig);

    projection->setSelection( oldSelection );
}

If a layer has more than one filter mask, and if we split up a recomposition 
task in chunks, then it is very likely that there will be more than one 
KisFilterMask active on the same projection paint device. Which means that 
they change the selection while another iterator from another filter is 
accessing them.

Poof!

My feeling is that the only solution is to take KisSelection away from 
KisPaintDevice, but that means that the iterator's isSelected methods no 
longer work and that we have to manually create an iterator on a selection 
every time we access a paint device.

Any ideas?
-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20071004/d6a928a8/attachment.pgp 


More information about the kimageshop mailing list