| 413 | } |
| 414 | |
| 415 | bool |
| 416 | EffectInstance::Implementation::aborted(bool isRenderResponseToUserInteraction, |
| 417 | const AbortableRenderInfoPtr& abortInfo, |
| 418 | const EffectInstancePtr& treeRoot) |
| 419 | { |
| 420 | if (!isRenderResponseToUserInteraction) { |
| 421 | // Rendering is playback or render on disk |
| 422 | |
| 423 | // If we have abort info, e just peek the atomic int inside the abort info, this is very fast |
| 424 | if ( abortInfo && abortInfo->isAborted() ) { |
| 425 | return true; |
| 426 | } |
| 427 | |
| 428 | // Fallback on the flag set on the node that requested the render in OutputSchedulerThread |
| 429 | if (treeRoot) { |
| 430 | OutputEffectInstance* effect = dynamic_cast<OutputEffectInstance*>( treeRoot.get() ); |
| 431 | assert(effect); |
| 432 | if (effect) { |
| 433 | return effect->isSequentialRenderBeingAborted(); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | // We have no other means to know if abort was called |
| 438 | return false; |
| 439 | } else { |
| 440 | // This is a render issued to refresh the image on the Viewer |
| 441 | |
| 442 | if ( !abortInfo || !abortInfo->canAbort() ) { |
| 443 | // We do not have any abortInfo set or this render is not abortable. This should be avoided as much as possible! |
| 444 | return false; |
| 445 | } |
| 446 | |
| 447 | // This is very fast, we just peek the atomic int inside the abort info |
| 448 | if ( (int)abortInfo->isAborted() ) { |
| 449 | return true; |
| 450 | } |
| 451 | |
| 452 | // If this node can start sequential renders (e.g: start playback like on the viewer or render on disk) and it is already doing a sequential render, abort |
| 453 | // this render |
| 454 | OutputEffectInstance* isRenderEffect = dynamic_cast<OutputEffectInstance*>( treeRoot.get() ); |
| 455 | if (isRenderEffect) { |
| 456 | if ( isRenderEffect->isDoingSequentialRender() ) { |
| 457 | return true; |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | // The render was not aborted |
| 462 | return false; |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | bool |
| 467 | EffectInstance::aborted() const |
no test coverage detected