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
// 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;
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 )
// Draw media which already exists
+ Track *track = edit->track;
if( track->draw ) {
switch( track->data_type )
{
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
}
// if( total_x > -BC_INFINITY ) {
char title[BCTEXTLEN];
- char channel[BCTEXTLEN];
- title[0] = 0;
- channel[0] = 0;
- FileSystem fs;
-
- if( edit->user_title[0] )
- strcpy(title, edit->user_title);
- else if( edit->nested_edl ) {
-//printf("ResourcePixmap::draw_title %s\n", edit->nested_edl->project_path);
- fs.extract_name(title, edit->nested_edl->path);
-
-// EDLs only have 1 video output
- if( edit->track->data_type == TRACK_AUDIO ) {
- sprintf(channel, " #%d", edit->channel + 1);
- strcat(title, channel);
- }
- }
- else if( edit->asset ) {
- fs.extract_name(title, edit->asset->path);
- sprintf(channel, " #%d", edit->channel + 1);
- strcat(title, channel);
- }
-
+ edit->get_title(title);
canvas->set_color(mwindow->theme->title_color);
canvas->set_font(mwindow->theme->title_font);
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;
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 -
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
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;