From 2f0ce0b5fd34f79fc1eba949f197cea3c47d5a41 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Thu, 16 May 2019 18:47:17 -0600 Subject: [PATCH] correct kfrm span maskauto update_params, avoid zero w/h draw_refresh segv --- cinelerra-5.1/cinelerra/cwindowtool.C | 23 +++++++++--- cinelerra-5.1/cinelerra/maskauto.C | 15 +++----- cinelerra-5.1/cinelerra/vwindowgui.C | 51 ++++++++++++--------------- 3 files changed, 46 insertions(+), 43 deletions(-) diff --git a/cinelerra-5.1/cinelerra/cwindowtool.C b/cinelerra-5.1/cinelerra/cwindowtool.C index e077be34..fc44683e 100644 --- a/cinelerra-5.1/cinelerra/cwindowtool.C +++ b/cinelerra-5.1/cinelerra/cwindowtool.C @@ -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; diff --git a/cinelerra-5.1/cinelerra/maskauto.C b/cinelerra-5.1/cinelerra/maskauto.C index 74eec3a8..831b899d 100644 --- a/cinelerra-5.1/cinelerra/maskauto.C +++ b/cinelerra-5.1/cinelerra/maskauto.C @@ -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; iget_submask(i)->equivalent(*ref->get_submask(i))) this->get_submask(i)->copy_from(*src->get_submask(i)); } diff --git a/cinelerra-5.1/cinelerra/vwindowgui.C b/cinelerra-5.1/cinelerra/vwindowgui.C index e1524d6d..69ad7bbf 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.C +++ b/cinelerra-5.1/cinelerra/vwindowgui.C @@ -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); } -- 2.26.2