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

Method isIdentity

Rectangle/Rectangle.cpp:887–951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

885}
886
887bool
888RectanglePlugin::isIdentity(const IsIdentityArguments &args,
889 Clip * &identityClip,
890 double &identityTime
891 , int& view, std::string& plane)
892{
893 if ( GeneratorPlugin::isIdentity(args, identityClip, identityTime, view, plane) ) {
894 return true;
895 }
896
897 if (!_srcClip || !_srcClip->isConnected()) {
898 return false;
899 }
900 const double time = args.time;
901 double mix = _mix->getValueAtTime(time);
902
903 if (mix == 0. /*|| (!processR && !processG && !processB && !processA)*/) {
904 identityClip = _srcClip;
905
906 return true;
907 }
908
909 {
910 bool processR = _processR->getValueAtTime(time);
911 bool processG = _processG->getValueAtTime(time);
912 bool processB = _processB->getValueAtTime(time);
913 bool processA = _processA->getValueAtTime(time);
914 if (!processR && !processG && !processB && !processA) {
915 identityClip = _srcClip;
916
917 return true;
918 }
919 }
920
921 RGBAValues color0, color1;
922 _color0->getValueAtTime(time, color0.r, color0.g, color0.b, color0.a);
923 _color1->getValueAtTime(time, color1.r, color1.g, color1.b, color1.a);
924 if ( (color0.r == 0.) && (color0.g == 0.) && (color0.b == 0.) && (color0.a == 0.) &&
925 (color1.r == 0.) && (color1.g == 0.) && (color1.b == 0.) && (color1.a == 0.) ) {
926 identityClip = _srcClip;
927
928 return true;
929 }
930
931 bool doMasking = ( ( !_maskApply || _maskApply->getValueAtTime(time) ) && _maskClip && _maskClip->isConnected() );
932 if (doMasking) {
933 bool maskInvert = _maskInvert->getValueAtTime(time);
934 if (!maskInvert) {
935 OfxRectI maskRoD;
936 if (getImageEffectHostDescription()->supportsMultiResolution) {
937 // In Sony Catalyst Edit, clipGetRegionOfDefinition returns the RoD in pixels instead of canonical coordinates.
938 // In hosts that do not support multiResolution (e.g. Sony Catalyst Edit), all inputs have the same RoD anyway.
939 Coords::toPixelEnclosing(_maskClip->getRegionOfDefinition(time), args.renderScale, _maskClip->getPixelAspectRatio(), &maskRoD);
940 // effect is identity if the renderWindow doesn't intersect the mask RoD
941 if ( !Coords::rectIntersection<OfxRectI>(args.renderWindow, maskRoD, 0) ) {
942 identityClip = _srcClip;
943
944 return true;

Callers

nothing calls this directly

Calls 3

isConnectedMethod · 0.80
getValueAtTimeMethod · 0.80
getRegionOfDefinitionMethod · 0.45

Tested by

no test coverage detected