MCPcopy Create free account
hub / github.com/NatronGitHub/openfx-misc / getOutputFormat

Method getOutputFormat

Reformat/Reformat.cpp:352–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350}
351
352void
353ReformatPlugin::getOutputFormat(const double time,
354 double* par,
355 OfxRectD* rect,
356 OfxRectI* format) const
357{
358 int type_i;
359
360 _type->getValue(type_i);
361 OfxPointI boxSize;
362 double boxPAR;
363 bool boxFixed;
364 getBoxValues(time, &boxSize.x, &boxSize.y, &boxPAR, &boxFixed);
365
366 ResizeEnum resize = (ResizeEnum)_resize->getValueAtTime(time);
367 bool center = _center->getValueAtTime(time);
368 //bool flip = _flip->getValueAtTime(time);
369 //bool flop = _flop->getValueAtTime(time);
370 bool turn = _turn->getValueAtTime(time);
371 // same as getRegionOfDefinition, but without rounding, and without conversion to pixels
372
373
374 if (format && boxFixed) { // the non-boxFixed case is treated at the end of the function
375 format->x1 = format->y1 = 0;
376 format->x2 = boxSize.x;
377 format->y2 = boxSize.y;
378 }
379
380 if ( (boxSize.x == 0) && (boxSize.y == 0) ) {
381 //probably scale is 0
382 rect->x1 = rect->y1 = rect->x2 = rect->y2 = 0;
383 *par = 1.;
384 if (format) {
385 format->x1 = format->y1 = format->x2 = format->y2 = 0;
386 }
387
388 return;
389 }
390 OfxRectD boxRod = { 0., 0., (double)boxSize.x * boxPAR, (double)boxSize.y};
391
392 OfxRectD srcRod;
393 {
394 double par;
395 OfxRectD format;
396 const OfxPointD rsOne = {1., 1.}; // format is with respect to unit renderscale
397 getInputFormat(time, &par, &format);
398 Coords::toCanonical(format, rsOne, par, &srcRod);
399 }
400 if ( Coords::rectIsEmpty(srcRod) ) {
401 // degenerate case
402 rect->x1 = rect->y1 = rect->x2 = rect->y2 = 0;
403 *par = 1.;
404 if (format) {
405 format->x1 = format->y1 = format->x2 = format->y2 = 0;
406 }
407
408 return;
409 }

Callers

nothing calls this directly

Calls 1

getValueAtTimeMethod · 0.80

Tested by

no test coverage detected