quint32* EffectUser::applyFilters( const Workflow::Frame* frame, qint64 currentFrame, double time ) { QReadLocker lock( m_effectsLock ); if ( m_filters.size() == 0 ) return NULL; EffectsEngine::EffectList::const_iterator it = m_filters.constBegin(); EffectsEngine::EffectList::const_iterator ite = m_filters.constEnd(); quint32 *buff1 = NULL; quint32 *buff2 = NULL; const quint32 *input = frame->buffer(); bool firstBuff = true; while ( it != ite ) { if ( (*it)->begin() < currentFrame && ( (*it)->end() < 0 || (*it)->end() > currentFrame ) ) { quint32 **buff; if ( firstBuff == true ) buff = &buff1; else buff = &buff2; if ( *buff == NULL ) *buff = new quint32[frame->nbPixels()]; EffectInstance *effect = (*it)->effectInstance(); effect->process( time, input, *buff ); input = *buff; firstBuff = !firstBuff; } ++it; } if ( buff1 != NULL || buff2 != NULL ) { if ( firstBuff == true ) { delete[] buff1; return buff2; } else { delete[] buff2; return buff1; } } return NULL; }