X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fshapewipe%2Fshapewipe.C;h=bb91c5ecc6cd345113758cb4d23827f94d994588;hb=49f85559268fc040fe7ba5611cc0520793cf728b;hp=1656e7f1d62bfb219c74abca3f537b403a12ac7e;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/plugins/shapewipe/shapewipe.C b/cinelerra-5.1/plugins/shapewipe/shapewipe.C index 1656e7f1..bb91c5ec 100644 --- a/cinelerra-5.1/plugins/shapewipe/shapewipe.C +++ b/cinelerra-5.1/plugins/shapewipe/shapewipe.C @@ -21,6 +21,7 @@ #include "bcdisplayinfo.h" #include "bchash.h" +#include "cstrdup.h" #include "edl.inc" #include "filesystem.h" #include "filexml.h" @@ -332,6 +333,8 @@ ShapeWipeMain::ShapeWipeMain(PluginServer *server) preserve_aspect = 0; last_preserve_aspect = 0; shapes_initialized = 0; + shape_paths.set_array_delete(); + shape_titles.set_array_delete(); } ShapeWipeMain::~ShapeWipeMain() @@ -399,8 +402,8 @@ void ShapeWipeMain::init_shapes() FileItem *file_item = fs.get_entry(i); if(!file_item->get_is_dir()) { - shape_paths.append(strdup(file_item->get_path())); - char *ptr = strdup(file_item->get_name()); + shape_paths.append(cstrdup(file_item->get_path())); + char *ptr = cstrdup(file_item->get_name()); char *ptr2 = strrchr(ptr, '.'); if(ptr2) *ptr2 = 0; shape_titles.append(ptr); @@ -610,26 +613,40 @@ void ShapeWipeMain::reset_pattern_image() type *in_row; \ type *out_row; \ \ - for(j = 0; j < h; j++) \ - { \ - in_row = (type*) in_rows[j]; \ - out_row = (type*)out_rows[j]; \ - pattern_row = pattern_image[j]; \ - \ - col_offset = 0; \ - for(k = 0; k < w; k++) \ - { \ - value = pattern_row[k]; \ - if ((direction == 0 && value >= threshold) || \ - (direction == 1 && value <= threshold)) \ - { \ + if( !direction ) { \ + for(j = 0; j < h; j++) { \ + in_row = (type*) in_rows[j]; \ + out_row = (type*)out_rows[j]; \ + pattern_row = pattern_image[j]; \ + \ + col_offset = 0; \ + for(k = 0; k < w; k++, col_offset += components ) { \ + value = pattern_row[k]; \ + if (value < threshold) continue; \ + out_row[col_offset] = in_row[col_offset]; \ + out_row[col_offset + 1] = in_row[col_offset + 1]; \ + out_row[col_offset + 2] = in_row[col_offset + 2]; \ + if(components == 4) \ + out_row[col_offset + 3] = in_row[col_offset + 3]; \ + } \ + } \ + } \ + else { \ + for(j = 0; j < h; j++) { \ + in_row = (type*) in_rows[j]; \ + out_row = (type*)out_rows[j]; \ + pattern_row = pattern_image[j]; \ + \ + col_offset = 0; \ + for(k = 0; k < w; k++, col_offset += components ) { \ + value = pattern_row[k]; \ + if (value > threshold) continue; \ out_row[col_offset] = in_row[col_offset]; \ out_row[col_offset + 1] = in_row[col_offset + 1]; \ out_row[col_offset + 2] = in_row[col_offset + 2]; \ if(components == 4) \ out_row[col_offset + 3] = in_row[col_offset + 3]; \ } \ - col_offset += components; \ } \ } \ }