record batch dir path fix, handle yuv in gl masking, sync up maskengine/playback3d...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / overlay / overlay.C
index 8f8cdea5693999439027ac3badb3036f059d7ad2..a77898f37ce988a53b89c0b452922bfd45681062 100644 (file)
@@ -22,6 +22,7 @@
 #include "bcdisplayinfo.h"
 #include "clip.h"
 #include "bchash.h"
 #include "bcdisplayinfo.h"
 #include "clip.h"
 #include "bchash.h"
+#include "edl.h"
 #include "edlsession.h"
 #include "filexml.h"
 #include "guicast.h"
 #include "edlsession.h"
 #include "filexml.h"
 #include "guicast.h"
@@ -393,7 +394,7 @@ int Overlay::process_buffer(VFrame **frame,
 {
        load_configuration();
 
 {
        load_configuration();
 
-       EDLSession* session = get_edlsession();
+       EDLSession* session = get_edl()->session;
        int interpolation_type = session ? session->interpolation_type : NEAREST_NEIGHBOR;
 
        int step = config.direction == OverlayConfig::BOTTOM_FIRST ?  -1 : 1;
        int interpolation_type = session ? session->interpolation_type : NEAREST_NEIGHBOR;
 
        int step = config.direction == OverlayConfig::BOTTOM_FIRST ?  -1 : 1;
@@ -484,20 +485,12 @@ int Overlay::handle_opengl()
 #undef TWO
 #define TWO 2.0
 
 #undef TWO
 #define TWO 2.0
 
-static const char *blend_NORMAL_frag =
-       "       vec4 result = mix(src_color, src_color, src_color.a);\n";
-
-static const char *blend_ADDITION_frag =
-       "       vec4 result = dst_color + src_color;\n"
-       "       result = clamp(result, 0.0, 1.0);\n";
-
-static const char *blend_SUBTRACT_frag =
-       "       vec4 result = dst_color - src_color;\n"
-       "       result = clamp(result, 0.0, 1.0);\n";
-
 static const char *blend_REPLACE_frag =
        "       vec4 result = src_color;\n";
 
 static const char *blend_REPLACE_frag =
        "       vec4 result = src_color;\n";
 
+GL_VEC_FRAG(NORMAL);
+GL_VEC_FRAG(ADDITION);
+GL_VEC_FRAG(SUBTRACT);
 GL_STD_FRAG(MULTIPLY);
 GL_VEC_FRAG(DIVIDE);
 GL_VEC_FRAG(MAX);
 GL_STD_FRAG(MULTIPLY);
 GL_VEC_FRAG(DIVIDE);
 GL_VEC_FRAG(MAX);
@@ -571,21 +564,6 @@ static const char * const overlay_shaders[TRANSFER_TYPES] = {
                dst->init_screen();
                src->draw_texture();
                break;
                dst->init_screen();
                src->draw_texture();
                break;
-       case TRANSFER_NORMAL:
-// Move destination to screen
-               if( dst->get_opengl_state() != VFrame::SCREEN ) {
-                       dst->to_texture();
-                       dst->enable_opengl();
-                       dst->init_screen();
-                       dst->draw_texture();
-               }
-               src->to_texture();
-               dst->enable_opengl();
-               dst->init_screen();
-               glEnable(GL_BLEND);
-               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-               src->draw_texture();
-               break;
        default:
                src->to_texture();
                dst->to_texture();
        default:
                src->to_texture();
                dst->to_texture();