X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmaskengine.C;h=ed7cbaaebdbddfafcf72709f205eb891f5542e42;hp=7f7917661e9194ae0094bac728be432f2f0ccf3a;hb=7e5a0760f40ff787cc3d93cb7768a901ebe52809;hpb=21c2e6b36d6a96c2f662a89459d607b5a387f4eb diff --git a/cinelerra-5.1/cinelerra/maskengine.C b/cinelerra-5.1/cinelerra/maskengine.C index 7f791766..ed7cbaae 100644 --- a/cinelerra-5.1/cinelerra/maskengine.C +++ b/cinelerra-5.1/cinelerra/maskengine.C @@ -370,22 +370,14 @@ SET_TRACE SET_TRACE if(temp && (temp->get_w() != oversampled_package_w || - temp->get_h() != oversampled_package_h)) - { - delete temp; - temp = 0; + temp->get_h() != oversampled_package_h)) { + delete temp; temp = 0; } //printf("MaskUnit::process_package 1\n"); SET_TRACE - if(!temp) - { - temp = new VFrame(0, - -1, - oversampled_package_w, - oversampled_package_h, - BC_A8, - -1); + if(!temp) { + temp = new VFrame(oversampled_package_w, oversampled_package_h, BC_A8, 0); } SET_TRACE @@ -868,18 +860,10 @@ SET_TRACE recalculate = 1; if(!mask) { - mask = new VFrame(0, - -1, - output->get_w(), - output->get_h(), - new_color_model, - -1); - temp_mask = new VFrame(0, - -1, - output->get_w(), - output->get_h(), - new_color_model, - -1); + mask = new VFrame(output->get_w(), output->get_h(), + new_color_model, 0); + temp_mask = new VFrame(output->get_w(), output->get_h(), + new_color_model, 0); } if(new_feather > 0) temp_mask->clear_frame(); @@ -934,19 +918,15 @@ void MaskEngine::init_packages() { SET_TRACE //printf("MaskEngine::init_packages 1\n"); - int division = (int)((float)output->get_h() / (get_total_packages() / 2) + 0.5); - if(division < 1) division = 1; - + int x0 = 0, y0 = 0, i = 0, n = get_total_packages(); + int out_w = output->get_w(), out_h = output->get_h(); SET_TRACE - for(int i = 0; i < get_total_packages(); i++) - { - MaskPackage *ptr = (MaskPackage*)get_package(i); - - ptr->start_y = output->get_h() * i / get_total_packages(); - ptr->end_y = output->get_h() * (i + 1) / get_total_packages(); - - ptr->start_x = output->get_w() * i / get_total_packages(); - ptr->end_x = output->get_w() * (i + 1) / get_total_packages(); + while( i < n ) { + MaskPackage *ptr = (MaskPackage*)get_package(i++); + int x1 = (out_w * i) / n, y1 = (out_h * i) / n; + ptr->start_x = x0; ptr->end_x = x1; + ptr->start_y = y0; ptr->end_y = y1; + x0 = x1; y0 = y1; } SET_TRACE //printf("MaskEngine::init_packages 2\n");