correct kfrm span maskauto update_params, avoid zero w/h draw_refresh segv
authorGood Guy <good1.2guy@gmail.com>
Fri, 17 May 2019 00:47:17 +0000 (18:47 -0600)
committerGood Guy <good1.2guy@gmail.com>
Fri, 17 May 2019 00:47:17 +0000 (18:47 -0600)
cinelerra-5.1/cinelerra/cwindowtool.C
cinelerra-5.1/cinelerra/maskauto.C
cinelerra-5.1/cinelerra/vwindowgui.C

index e077be34a663992752e5e860893e9cc42edfc07a..fc44683e4daff529a5e42d56896f76b3f8c16166 100644 (file)
@@ -1786,7 +1786,6 @@ int CWindowMaskFeather::update_value(float v)
 #else
                keyframe->feather = v;
 #endif
-
                gui->update_preview();
        }
 
@@ -1994,7 +1993,15 @@ int CWindowMaskBeforePlugins::handle_event()
        ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 1);
 
        if (keyframe) {
-               keyframe->apply_before_plugins = get_value();
+               int v = get_value();
+#ifdef USE_KEYFRAME_SPANNING
+               MaskAuto temp_keyframe(gui->mwindow->edl, autos);
+               temp_keyframe.copy_data(keyframe);
+               temp_keyframe.apply_before_plugins = v;
+               autos->update_parameter(&temp_keyframe);
+#else
+               keyframe->apply_before_plugins = v;
+#endif
                gui->update_preview();
        }
        return 1;
@@ -2016,8 +2023,16 @@ int CWindowDisableOpenGLMasking::handle_event()
        MaskPoint *point;
        ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 1);
 
-       if (keyframe) {
-               keyframe->disable_opengl_masking = get_value();
+       if( keyframe ) {
+               int v = get_value();
+#ifdef USE_KEYFRAME_SPANNING
+               MaskAuto temp_keyframe(gui->mwindow->edl, autos);
+               temp_keyframe.copy_data(keyframe);
+               temp_keyframe.disable_opengl_masking = v;
+               autos->update_parameter(&temp_keyframe);
+#else
+               keyframe->disable_opengl_masking = v;
+#endif
                gui->update_preview();
        }
        return 1;
index 74eec3a857bbf549f8d51bef2db2c48d80165de2..831b899db7fead6ef8f87d4d460522dee3716cc1 100644 (file)
@@ -274,22 +274,17 @@ int MaskAuto::identical(MaskAuto *src)
 void MaskAuto::update_parameter(MaskAuto *ref, MaskAuto *src)
 {
        if(src->value != ref->value)
-       {
                this->value = src->value;
-       }
-
        if(src->mode != ref->mode)
-       {
                this->mode = src->mode;
-       }
-
+       if(src->apply_before_plugins != ref->apply_before_plugins)
+               this->apply_before_plugins = src->apply_before_plugins;
+       if(src->disable_opengl_masking != ref->disable_opengl_masking)
+               this->disable_opengl_masking = src->disable_opengl_masking;
        if(!EQUIV(src->feather, ref->feather))
-       {
                this->feather = src->feather;
-       }
 
-       for(int i = 0; i < masks.size(); i++)
-       {
+       for( int i=0; i<masks.size(); ++i ) {
                if(!src->get_submask(i)->equivalent(*ref->get_submask(i)))
                        this->get_submask(i)->copy_from(*src->get_submask(i));
        }
index e1524d6dd269adbadd1a6b276b09a4dbbb769070..69ad7bbf2ea4ad1b0c8ef8983248857986a8fa18 100644 (file)
@@ -823,37 +823,30 @@ void VWindowCanvas::draw_refresh(int flush)
 {
        EDL *edl = gui->vwindow->get_edl();
 
-       if(!get_canvas()->get_video_on()) get_canvas()->clear_box(0, 0, get_canvas()->get_w(), get_canvas()->get_h());
-       if(!get_canvas()->get_video_on() && refresh_frame && edl)
-       {
-               float in_x1, in_y1, in_x2, in_y2;
-               float out_x1, out_y1, out_x2, out_y2;
-               get_transfers(edl,
-                       in_x1, in_y1, in_x2, in_y2,
-                       out_x1, out_y1, out_x2, out_y2);
+       if( !get_canvas()->get_video_on() ) {
+               int cw = get_canvas()->get_w(), ch = get_canvas()->get_h();
+               get_canvas()->clear_box(0, 0, cw, ch);
+               int ow = get_output_w(edl), oh = get_output_h(edl);
+               if( ow > 0 && oh > 0 && refresh_frame && edl ) {
+                       float in_x1, in_y1, in_x2, in_y2;
+                       float out_x1, out_y1, out_x2, out_y2;
+                       get_transfers(edl,
+                               in_x1, in_y1, in_x2, in_y2,
+                               out_x1, out_y1, out_x2, out_y2);
 // input scaled from session to refresh frame coordinates
-               int ow = get_output_w(edl);
-               int oh = get_output_h(edl);
-               int rw = refresh_frame->get_w();
-               int rh = refresh_frame->get_h();
-               float xs = (float)rw / ow;
-               float ys = (float)rh / oh;
-               in_x1 *= xs;  in_x2 *= xs;
-               in_y1 *= ys;  in_y2 *= ys;
-               get_canvas()->draw_vframe(refresh_frame,
-                               (int)out_x1,
-                               (int)out_y1,
-                               (int)(out_x2 - out_x1),
-                               (int)(out_y2 - out_y1),
-                               (int)in_x1,
-                               (int)in_y1,
-                               (int)(in_x2 - in_x1),
-                               (int)(in_y2 - in_y1),
+                       int rw = refresh_frame->get_w();
+                       int rh = refresh_frame->get_h();
+                       float xs = (float)rw / ow;
+                       float ys = (float)rh / oh;
+                       in_x1 *= xs;  in_x2 *= xs;
+                       in_y1 *= ys;  in_y2 *= ys;
+                       get_canvas()->draw_vframe(refresh_frame,
+                               (int)out_x1, (int)out_y1,
+                               (int)(out_x2 - out_x1), (int)(out_y2 - out_y1),
+                               (int)in_x1, (int)in_y1,
+                               (int)(in_x2 - in_x1), (int)(in_y2 - in_y1),
                                0);
-       }
-
-       if(!get_canvas()->get_video_on())
-       {
+               }
                draw_overlays();
                get_canvas()->flash(flush);
        }