resourcethread redraw speedup/fixes, replace vectorscope graticule IQ
authorGood Guy <[email protected]>
Sat, 25 Apr 2020 03:58:19 +0000 (21:58 -0600)
committerGood Guy <[email protected]>
Sat, 25 Apr 2020 03:58:19 +0000 (21:58 -0600)
cinelerra-5.1/cinelerra/resourcepixmap.C
cinelerra-5.1/cinelerra/resourcethread.C
cinelerra-5.1/cinelerra/resourcethread.h
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/plugins/scopes/IQ.png

index 1201f044073d01511c461fb56b0d0f6ec172042d..53c116d6bf93f2a1994398d97c7cd9c5286e4212 100644 (file)
@@ -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 :
index 076b0436cf1dbd85c8daa9379db37a487db4c046..895dd506c3f963ab20e5576f5289ce16ac83c348 100644 (file)
@@ -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:
index 0d165ff5ccf3b6105d78f13715da0e2811bc539e..51f462c9941cc69eb3ec862591c4a40c5b8b4d09 100644 (file)
@@ -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<ResourceThreadItem>
 {
 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<ResourceThreadItem*> items;
+       List<ResourceThreadItem> items;
        int interrupted;
        int done;
        VFrame *temp_picon;
index fc31969dc170aea124aa9b12af82211a1d0bbd66..fa52b9c08e8d1bc0be19a82f333a7d88c6ad857f 100644 (file)
@@ -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;
index 67f5fb8866400dca49b34c18ebe9cc10678f7a2c..2d9ffa61f535b5dea3f4778beb782c7b412b3df3 100644 (file)
Binary files a/cinelerra-5.1/plugins/scopes/IQ.png and b/cinelerra-5.1/plugins/scopes/IQ.png differ