set up and run a processor */
| 342 | |
| 343 | /* set up and run a processor */ |
| 344 | void |
| 345 | KeyMixPlugin::setupAndProcess(KeyMixProcessorBase &processor, |
| 346 | const RenderArguments &args) |
| 347 | { |
| 348 | const double time = args.time; |
| 349 | |
| 350 | auto_ptr<Image> dst( _dstClip->fetchImage(time) ); |
| 351 | |
| 352 | if ( !dst.get() ) { |
| 353 | throwSuiteStatusException(kOfxStatFailed); |
| 354 | } |
| 355 | # ifndef NDEBUG |
| 356 | BitDepthEnum dstBitDepth = dst->getPixelDepth(); |
| 357 | PixelComponentEnum dstComponents = dst->getPixelComponents(); |
| 358 | if ( ( dstBitDepth != _dstClip->getPixelDepth() ) || |
| 359 | ( dstComponents != _dstClip->getPixelComponents() ) ) { |
| 360 | setPersistentMessage(Message::eMessageError, "", "OFX Host gave image with wrong depth or components"); |
| 361 | throwSuiteStatusException(kOfxStatFailed); |
| 362 | } |
| 363 | checkBadRenderScaleOrField(dst, args); |
| 364 | # endif |
| 365 | auto_ptr<const Image> srcA( ( _srcClipA && _srcClipA->isConnected() ) ? |
| 366 | _srcClipA->fetchImage(time) : 0 ); |
| 367 | auto_ptr<const Image> srcB( ( _srcClipB && _srcClipB->isConnected() ) ? |
| 368 | _srcClipB->fetchImage(time) : 0 ); |
| 369 | |
| 370 | # ifndef NDEBUG |
| 371 | if ( srcA.get() ) { |
| 372 | checkBadRenderScaleOrField(srcA, args); |
| 373 | BitDepthEnum srcBitDepth = srcA->getPixelDepth(); |
| 374 | PixelComponentEnum srcComponents = srcA->getPixelComponents(); |
| 375 | if ( (srcBitDepth != dstBitDepth) || (srcComponents != dstComponents) ) { |
| 376 | throwSuiteStatusException(kOfxStatErrImageFormat); |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | if ( srcB.get() ) { |
| 381 | checkBadRenderScaleOrField(srcB, args); |
| 382 | BitDepthEnum srcBitDepth = srcB->getPixelDepth(); |
| 383 | PixelComponentEnum srcComponents = srcB->getPixelComponents(); |
| 384 | if ( (srcBitDepth != dstBitDepth) || (srcComponents != dstComponents) ) { |
| 385 | throwSuiteStatusException(kOfxStatErrImageFormat); |
| 386 | } |
| 387 | } |
| 388 | # endif |
| 389 | |
| 390 | // auto ptr for the mask. |
| 391 | bool doMasking = ( ( !_maskApply || _maskApply->getValueAtTime(time) ) && _maskClip && _maskClip->isConnected() ); |
| 392 | auto_ptr<const Image> mask(doMasking ? _maskClip->fetchImage(time) : 0); |
| 393 | |
| 394 | // do we do masking |
| 395 | if (doMasking) { |
| 396 | bool maskInvert; |
| 397 | _maskInvert->getValueAtTime(time, maskInvert); |
| 398 | |
| 399 | // Set it in the processor |
| 400 | processor.setMaskImg(mask.get(), maskInvert); |
| 401 | } |
nothing calls this directly
no test coverage detected