X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fresourcepixmap.C;h=2ffd86ca58287ecc74747ca45926331e82f4f38f;hp=6f74c85dcf3a4de2a052acd1a1139a9424b707d4;hb=2e48b660e37eb5c661264d601211e16cb6cd6e89;hpb=47ad0dcdda5b5ae53931025c581eef1782fc5e12 diff --git a/cinelerra-5.1/cinelerra/resourcepixmap.C b/cinelerra-5.1/cinelerra/resourcepixmap.C index 6f74c85d..2ffd86ca 100644 --- a/cinelerra-5.1/cinelerra/resourcepixmap.C +++ b/cinelerra-5.1/cinelerra/resourcepixmap.C @@ -115,16 +115,38 @@ void ResourcePixmap::resize(int w, int h) BC_Pixmap::resize(new_w, new_h); } +void ResourcePixmap::update_settings(Edit *edit, + int64_t edit_x, int64_t edit_w, + int64_t pixmap_x, int64_t pixmap_w, int64_t pixmap_h) +{ + this->edit_id = edit->id; + this->edit_x = edit_x; + this->pixmap_x = pixmap_x; + this->pixmap_w = pixmap_w; + this->pixmap_h = pixmap_h; + + startsource = edit->startsource; + if( edit->asset ) + source_framerate = edit->asset->frame_rate; + else + if( edit->nested_edl ) + source_framerate = edit->nested_edl->session->frame_rate; + if( edit->asset ) + source_samplerate = edit->asset->sample_rate; + else if( edit->nested_edl ) + source_samplerate = edit->nested_edl->session->sample_rate; + + project_framerate = edit->edl->session->frame_rate; + project_samplerate = edit->edl->session->sample_rate; + zoom_sample = mwindow->edl->local_session->zoom_sample; + zoom_track = mwindow->edl->local_session->zoom_track; + zoom_y = mwindow->edl->local_session->zoom_y; +} void ResourcePixmap::draw_data(TrackCanvas *canvas, - Edit *edit, - int64_t edit_x, - int64_t edit_w, - int64_t pixmap_x, - int64_t pixmap_w, - int64_t pixmap_h, - int mode, - int indexes_only) + Edit *edit, int64_t edit_x, int64_t edit_w, + int64_t pixmap_x, int64_t pixmap_w, int64_t pixmap_h, + int mode, int indexes_only) { // Get new areas to fill in relative to pixmap // Area to redraw relative to pixmap @@ -135,10 +157,8 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas, // if( mode == IGNORE_THREAD ) return; int y = 0; - if( mwindow->edl->session->show_titles ) + if( edit->track->show_titles() ) y += mwindow->theme->get_image("title_bg_data")->get_h(); - Track *track = edit->edits->track; - // If want indexes only & index can't be drawn, don't do anything. int need_redraw = 0; @@ -167,197 +187,10 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas, return; } - -// Redraw everything /* Incremental drawing is not possible with resource thread */ - if( 1 ) -// edit->startsource != this->startsource || -// mwindow->edl->session->sample_rate != project_samplerate || -// !EQUIV(mwindow->edl->session->frame_rate, project_framerate) || -// mwindow->edl->local_session->zoom_sample != zoom_sample || -// mwindow->edl->local_session->zoom_track != zoom_track || -// this->pixmap_h != pixmap_h || -// (data_type == TRACK_AUDIO && -// mwindow->edl->local_session->zoom_y != zoom_y) || -// (mode == 2) || -// need_redraw) - { -// Redraw the whole thing. - refresh_x = 0; - refresh_w = pixmap_w; - } - else { -// Start translated right - if( pixmap_w == this->pixmap_w && edit_x < this->edit_x && edit_w != pixmap_w ) { - refresh_w = this->edit_x - edit_x; - refresh_x = this->pixmap_w - refresh_w; - -// Moved completely off the pixmap - if( refresh_w > this->pixmap_w ) { - refresh_w = this->pixmap_w; - refresh_x = 0; - } - else { - copy_area(refresh_w, - y, - refresh_x, - mwindow->edl->local_session->zoom_track, - 0, - y); - } - } - else -// Start translated left - if( pixmap_w == this->pixmap_w && edit_x > this->edit_x && edit_w != pixmap_w ) { - refresh_x = 0; - refresh_w = edit_x - this->edit_x; - -// Moved completely off the pixmap - if( refresh_w > this->pixmap_w ) { - refresh_w = this->pixmap_w; - } - else { - copy_area(0, - y, - this->pixmap_w - refresh_w, - mwindow->edl->local_session->zoom_track, - refresh_w, - y); - } - } - else -// Start translated right and pixmap came off of right side - if( pixmap_w < this->pixmap_w && edit_x < this->edit_x && - this->edit_x + edit_w > this->pixmap_x + this->pixmap_w ) { - refresh_w = (this->edit_x + edit_w) - (this->pixmap_x + this->pixmap_w); - refresh_x = pixmap_w - refresh_w; - - if( refresh_w >= pixmap_w ) { - refresh_x = 0; - refresh_w = pixmap_w; - } - else { - copy_area(this->edit_x - edit_x, - y, - pixmap_w - refresh_w, - mwindow->edl->local_session->zoom_track, - 0, - y); - } - } - else -// Start translated right and reduced in size on the right. - if( pixmap_w < this->pixmap_w && edit_x < this->edit_x ) { - refresh_x = 0; - refresh_w = 0; - - copy_area(this->pixmap_w - pixmap_w, - y, - pixmap_w, - mwindow->edl->local_session->zoom_track, - 0, - y); - } - else -// Start translated left and pixmap came off left side - if( edit_x >= 0 && this->edit_x < 0 ) { - refresh_x = 0; - refresh_w = -this->edit_x; - - if( refresh_w > pixmap_w ) { - refresh_w = pixmap_w; - } - else { - copy_area(0, - y, - this->pixmap_w, - mwindow->edl->local_session->zoom_track, - refresh_w, - y); - } - } - else -// Start translated left and reduced in size on the right - if( pixmap_w < this->pixmap_w && edit_x > this->edit_x ) { - refresh_x = 0; - refresh_w = 0; - } - else -// Start translated right and left went into left side. - if( pixmap_w > this->pixmap_w && edit_x < 0 && this->edit_x > 0 ) { - refresh_w = pixmap_w - (edit_x + this->pixmap_w); - refresh_x = pixmap_w - refresh_w; - -// Moved completely off new pixmap - if( refresh_w > pixmap_w ) { - refresh_w = pixmap_w; - refresh_x = 0; - } - else { - copy_area(-edit_x, - y, - refresh_x, - mwindow->edl->local_session->zoom_track, - 0, - y); - } - } - else -// Start translated right and increased in size on the right - if( pixmap_w > this->pixmap_w && edit_x <= this->edit_x ) { - refresh_w = pixmap_w - this->pixmap_w; - refresh_x = pixmap_w - refresh_w; - } - else -// Start translated left and increased in size on the right - if( pixmap_w > this->pixmap_w && edit_x > this->edit_x ) { - refresh_x = 0; - refresh_w = edit_x - this->edit_x; - -// Moved completely off new pixmap - if( refresh_w > this->pixmap_w ) { - refresh_w = pixmap_w; - refresh_x = 0; - } -// Shift and insert - else { - copy_area(0, - y, - this->pixmap_w, - mwindow->edl->local_session->zoom_track, - refresh_w, - y); - } - } - } - -// Update pixmap settings - this->edit_id = edit->id; - this->startsource = edit->startsource; - - if( edit->asset ) - this->source_framerate = edit->asset->frame_rate; - else - if( edit->nested_edl ) - this->source_framerate = edit->nested_edl->session->frame_rate; - - if( edit->asset ) - this->source_samplerate = edit->asset->sample_rate; - else - if( edit->nested_edl ) - this->source_samplerate = edit->nested_edl->session->sample_rate; - - this->project_framerate = edit->edl->session->frame_rate; - this->project_samplerate = edit->edl->session->sample_rate; - this->edit_x = edit_x; - this->pixmap_x = pixmap_x; - this->pixmap_w = pixmap_w; - this->pixmap_h = pixmap_h; - this->zoom_sample = mwindow->edl->local_session->zoom_sample; - this->zoom_track = mwindow->edl->local_session->zoom_track; - this->zoom_y = mwindow->edl->local_session->zoom_y; - - +// Redraw everything + refresh_x = 0; + refresh_w = pixmap_w; // Draw background image if( refresh_w > 0 ) @@ -374,6 +207,7 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas, // Draw media which already exists + Track *track = edit->track; if( track->draw ) { switch( track->data_type ) { @@ -404,16 +238,6 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas, break; } } - -// Draw title -SET_TRACE - if( mwindow->edl->session->show_titles ) - draw_title(canvas, - edit, - edit_x, - edit_w, - pixmap_x, - pixmap_w); SET_TRACE } @@ -531,7 +355,7 @@ void ResourcePixmap::draw_audio_source(TrackCanvas *canvas, Edit *edit, int x, i w++; Indexable *indexable = edit->get_source(); int center_pixel = mwindow->edl->local_session->zoom_track / 2; - if( mwindow->edl->session->show_titles ) + if( edit->track->show_titles() ) center_pixel += mwindow->theme->get_image("title_bg_data")->get_h(); int64_t scale_y = mwindow->edl->local_session->zoom_y; int y_max = center_pixel + scale_y / 2 - 1; @@ -693,11 +517,12 @@ void ResourcePixmap::draw_audio_source(TrackCanvas *canvas, Edit *edit, int x, i canvas->test_timer(); } -void ResourcePixmap::draw_wave(TrackCanvas *canvas, int x, double high, double low) +void ResourcePixmap::draw_wave(TrackCanvas *canvas, + int x, double high, double low) { int top_pixel = 0; if( mwindow->edl->session->show_titles ) - top_pixel = mwindow->theme->get_image("title_bg_data")->get_h(); + top_pixel += mwindow->theme->get_image("title_bg_data")->get_h(); int center_pixel = mwindow->edl->local_session->zoom_track / 2 + top_pixel; int bottom_pixel = top_pixel + mwindow->edl->local_session->zoom_track; int y1 = (int)(center_pixel - @@ -733,7 +558,7 @@ void ResourcePixmap::draw_video_resource(TrackCanvas *canvas, if( frame_w < picon_w ) frame_w = picon_w; // Current pixel relative to pixmap int y = 0; - if( mwindow->edl->session->show_titles ) + if( edit->track->show_titles() ) y += mwindow->theme->get_image("title_bg_data")->get_h(); // Frame in project touched by current pixel @@ -781,8 +606,8 @@ void ResourcePixmap::draw_subttl_resource(TrackCanvas *canvas, Edit *edit, int x SEdit *sedit = (SEdit *)edit; char *text = sedit->get_text(); if( !*text || w < 10 ) return; - int center_pixel = mwindow->edl->local_session->zoom_track / 2; - if( mwindow->edl->session->show_titles ) + int center_pixel = canvas->resource_h() / 2; + if( edit->track->show_titles() ) center_pixel += mwindow->theme->get_image("title_bg_data")->get_h(); int64_t scale_y = mwindow->edl->local_session->zoom_y; int x0 = edit_x;