]> git.sesse.net Git - casparcg/blobdiff - core/producer/transition/transition_producer.cpp
2.0.0.2:
[casparcg] / core / producer / transition / transition_producer.cpp
index 17faf10be63d6bcc01052c5645fe1e6d7d5eaaee..81b86af1debe7aa2481aa22ab06cd63ddab0f353 100644 (file)
@@ -55,7 +55,7 @@ struct transition_producer::implementation : boost::noncopyable
                \r
        gpu_frame_ptr get_frame()\r
        {\r
-               if(++current_frame_ >= info_.duration)\r
+               if(current_frame_++ >= info_.duration)\r
                        return nullptr;\r
 \r
                gpu_frame_ptr source;\r
@@ -128,31 +128,42 @@ struct transition_producer::implementation : boost::noncopyable
                auto composite = std::make_shared<gpu_composite_frame>();\r
                if(src_frame)\r
                        composite->add(src_frame);\r
-               else\r
-                       src_frame = std::make_shared<gpu_frame>(0, 0);\r
                composite->add(dest_frame);\r
 \r
-               if(info_.type == transition_type::mix)\r
-                       dest_frame->alpha(alpha);               \r
-               else if(info_.type == transition_type::slide)\r
+               switch(info_.type)\r
                {\r
+               case transition_type::mix: \r
+                       dest_frame->alpha(alpha);       \r
+                       break;\r
+               case transition_type::slide:                    \r
                        if(info_.direction == transition_direction::from_left)                  \r
                                dest_frame->translate(-1.0+alpha, 0.0);                 \r
                        else if(info_.direction == transition_direction::from_right)\r
-                               dest_frame->translate(1.0-alpha, 0.0);                  \r
-               }\r
-               else if(info_.type == transition_type::push)\r
-               {\r
+                               dest_frame->translate(1.0-alpha, 0.0);          \r
+                       break;\r
+               case transition_type::push:\r
                        if(info_.direction == transition_direction::from_left)          \r
                        {\r
                                dest_frame->translate(-1.0+alpha, 0.0);\r
-                               src_frame->translate(0.0+alpha, 0.0);\r
+                               if(src_frame)\r
+                                       src_frame->translate(0.0+alpha, 0.0);\r
                        }\r
                        else if(info_.direction == transition_direction::from_right)\r
                        {\r
                                dest_frame->translate(1.0-alpha, 0.0);\r
-                               src_frame->translate(0.0-alpha, 0.0);\r
+                               if(src_frame)\r
+                                       src_frame->translate(0.0-alpha, 0.0);\r
                        }\r
+                       break;\r
+               }\r
+\r
+               if(info_.type == transition_type::mix)\r
+                       dest_frame->alpha(alpha);               \r
+               else if(info_.type == transition_type::slide)\r
+               {       \r
+               }\r
+               else if(info_.type == transition_type::push)\r
+               {\r
                }\r
                else if(info_.type == transition_type::wipe)\r
                {\r