From: Good Guy Date: Sat, 25 Apr 2020 03:58:19 +0000 (-0600) Subject: resourcethread redraw speedup/fixes, replace vectorscope graticule IQ X-Git-Tag: 2020-04~5 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=de541aa9508555c35ea284d5b03617fc9c7cd026;p=goodguy%2Fcinelerra.git resourcethread redraw speedup/fixes, replace vectorscope graticule IQ --- diff --git a/cinelerra-5.1/cinelerra/resourcepixmap.C b/cinelerra-5.1/cinelerra/resourcepixmap.C index 1201f044..53c116d6 100644 --- a/cinelerra-5.1/cinelerra/resourcepixmap.C +++ b/cinelerra-5.1/cinelerra/resourcepixmap.C @@ -155,7 +155,7 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas, int refresh_w = 0; // Ignore if called by resourcethread. -// if( mode == IGNORE_THREAD ) return; + if( mode == IGNORE_THREAD ) return; int y = 0; if( edit->track->show_titles() ) @@ -595,7 +595,7 @@ void ResourcePixmap::draw_wave(TrackCanvas *canvas, { int rect_audio = mwindow->preferences->rectify_audio; if( rect_audio ) { low = fabs(low); high = fabs(high); } - int top_pixel = mwindow->edl->session->show_titles ? 0 : + int top_pixel = !mwindow->edl->session->show_titles ? 0 : mwindow->theme->get_image("title_bg_data")->get_h(); int center_pixel = !rect_audio ? mwindow->edl->local_session->zoom_track / 2 + top_pixel : diff --git a/cinelerra-5.1/cinelerra/resourcethread.C b/cinelerra-5.1/cinelerra/resourcethread.C index 076b0436..895dd506 100644 --- a/cinelerra-5.1/cinelerra/resourcethread.C +++ b/cinelerra-5.1/cinelerra/resourcethread.C @@ -252,6 +252,17 @@ void ResourceThread::add_wave(ResourcePixmap *pixmap, item_lock->unlock(); } +void ResourceThread::reset(int pane_number) +{ + item_lock->lock("ResourceThread::reset"); + ResourceThreadItem *item = items.first; + while( item ) { + ResourceThreadItem *next_item = item->next; + if( item->pane_number == pane_number ) delete item; + item = next_item; + } + item_lock->unlock(); +} @@ -272,7 +283,8 @@ void ResourceThread::stop_draw(int reset) //printf("ResourceThread::stop_draw %d %d\n", __LINE__, reset); //BC_Signals::dump_stack(); if( reset ) { - items.remove_all_objects(); + ResourceThreadItem *item; + while( (item=items.last) != 0 ) delete item; ++operation_count; } item_lock->unlock(); @@ -286,9 +298,9 @@ void ResourceThread::start_draw() { interrupted = 0; // Tag last audio item to cause refresh. - int i = items.total; - while( --i>=0 && items[i]->data_type!=TRACK_AUDIO ); - if( i >= 0 ) items[i]->last = 1; + ResourceThreadItem *item = items.last; + while( item && item->data_type!=TRACK_AUDIO ) item = item->previous; + if( item ) item->last = 1; timer->update(); draw_lock->unlock(); } @@ -303,16 +315,11 @@ void ResourceThread::run() { // Pull off item item_lock->lock("ResourceThread::run"); - int total_items = items.size(); - ResourceThreadItem *item = 0; - if(items.size()) - { - item = items[0]; - items.remove_number(0); - } + ResourceThreadItem *item = items.first; + items.remove_pointer(item); item_lock->unlock(); //printf("ResourceThread::run %d %d\n", __LINE__, items.size()); - if(!total_items) break; + if(!item) break; switch( item->data_type ) { case TRACK_VIDEO: diff --git a/cinelerra-5.1/cinelerra/resourcethread.h b/cinelerra-5.1/cinelerra/resourcethread.h index 0d165ff5..51f462c9 100644 --- a/cinelerra-5.1/cinelerra/resourcethread.h +++ b/cinelerra-5.1/cinelerra/resourcethread.h @@ -32,6 +32,7 @@ #include "arraylist.h" +#include "linklist.h" #include "bctimer.inc" #include "condition.inc" #include "file.inc" @@ -44,7 +45,7 @@ #include "vframe.inc" -class ResourceThreadItem +class ResourceThreadItem : public ListItem { public: ResourceThreadItem(ResourcePixmap *pixmap, @@ -145,6 +146,7 @@ public: void run(); void stop(); + void reset(int pane_number); void do_video(VResourceThreadItem *item); void do_audio(AResourceThreadItem *item); @@ -160,7 +162,7 @@ public: MWindowGUI *gui; Condition *draw_lock; Mutex *item_lock; - ArrayList items; + List items; int interrupted; int done; VFrame *temp_picon; diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index fc31969d..fa52b9c0 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -779,6 +779,8 @@ void TrackCanvas::draw_resources(int mode, gui->resource_pixmaps.remove_all_objects(); if(debug) PRINT_TRACE + if(mode != IGNORE_THREAD) + gui->resource_thread->reset(pane->number); // Search every edit for(Track *current = mwindow->edl->tracks->first; diff --git a/cinelerra-5.1/plugins/scopes/IQ.png b/cinelerra-5.1/plugins/scopes/IQ.png index 67f5fb88..2d9ffa61 100644 Binary files a/cinelerra-5.1/plugins/scopes/IQ.png and b/cinelerra-5.1/plugins/scopes/IQ.png differ