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;
return result;
}
+static int is_linear(FloatAuto *prev, FloatAuto *next)
+{
+ if( !prev || !next ) return 1;
+ if( prev->curve_mode == FloatAuto::LINEAR ) return 1;
+ int64_t ipos = prev->get_control_in_position();
+ int64_t opos = prev->get_control_out_position();
+ if( !ipos && !opos ) return 1;
+ if( !ipos || !opos ) return 0;
+ float ival = prev->get_control_in_value();
+ float oval = prev->get_control_out_value();
+ float cval = prev->get_value(), nval = next->get_value();
+ if( !ival && !oval && EQUIV(cval, nval) ) return 1;
+ float ig = ival / ipos, og = oval / opos;
+ int64_t cpos = prev->position, npos = next->position;
+ float g = (nval - cval) / (npos - cpos);
+ if( EQUIV(ig, g) && EQUIV(og, g) ) return 1;
+ return 0;
+}
// Get the float value & y for position x on the canvas
#define X_TO_FLOATLINE(x) \
int x1, int y1, int x2, int y2,
int color, int autogrouptype)
{
+ int ytop = center_pixel - yscale / 2;
+ int ybot = center_pixel + yscale / 2 - 1;
+ y1 += center_pixel; y2 += center_pixel;
+ if( (y1 < ytop && y1 >= ybot) && (y2 < ytop || y2 >= ybot) ) return;
+// check for line draw
+ if( is_linear(previous, next) ) {
+ draw_line(x1, y1, x2, y2);
+ return;
+ }
+
// Solve bezier equation for either every pixel or a certain large number of
// points.
// Not using slope intercept
x1 = MAX(0, x1);
- int prev_y = y1 + center_pixel;
-
+ draw_pixel(x1, y1);
+ int prev_y = y1;
// Call by reference fails for some reason here
FloatAuto *previous1 = previous, *next1 = next;
float automation_min = mwindow->edl->local_session->automation_mins[autogrouptype];
float automation_max = mwindow->edl->local_session->automation_maxs[autogrouptype];
float automation_range = automation_max - automation_min;
-
- for(int x = x1; x < x2; x++)
- {
+ for( int x=x1; x<x2; ++x ) {
// Interpolate value between frames
X_TO_FLOATLINE(x)
- if(/* x > x1 && */
- y >= center_pixel - yscale / 2 &&
- y < center_pixel + yscale / 2 - 1)
- {
-// printf("TrackCanvas::draw_floatline y=%d min=%d max=%d\n",
-// y,
-// (int)(center_pixel - yscale / 2),
-// (int)(center_pixel + yscale / 2 - 1));
-
-//printf("draw_line(%d,%d, %d,%d)\n", x - 1, prev_y , x, y);
- draw_line(x - 1, prev_y , x, y );
+ if( /* x > x1 && */ y >= ytop && y < ybot ) {
+ int x1 = x-1, y1 = prev_y, x2 = x, y2 = y;
+ if( abs(y2-y1) < 2 )
+ draw_pixel(x2, y2);
+ else
+ draw_bline(x1, y1, x2, y2);
}
prev_y = y;
}
}
-
-
-
int TrackCanvas::test_floatline(int center_pixel,
FloatAutos *autos,
double unit_start,
delete video_cache;
mwindow->cwindow->gui->lock_window("TrackCanvas::render_handle_frame 0");
Canvas *canvas = mwindow->cwindow->gui->canvas;
- int w = canvas->w, h = canvas->h, w2 = w/2, h2 = h/2;
- int lx = 0, ly = h2/2, rx = w2, ry = h2/2;
+ float ox1, oy1, ox2, oy2, cx1, cy1, cx2, cy2;
+ canvas->get_transfers(edl, ox1, oy1, ox2, oy2, cx1, cy1, cx2, cy2);
+ float cw = canvas->w/2, ch = canvas->h/2;
+ float cdx = (cx2 - cx1)/2, cdy = (cy2 - cy1)/2;
+ int cx = cx1/2, cy = cy1/2 + ch/2;
+ int ow = ox2 - ox2, oh = oy2 - oy1;
BC_WindowBase *window = canvas->get_canvas();
window->set_color(BLACK);
window->clear_box(0,0, window->get_w(),window->get_h());
- window->draw_vframe(&vlt, lx,ly, w2,h2, 0,0,vlt.get_w(),vlt.get_h());
- window->draw_vframe(&vrt, rx,ry, w2,h2, 0,0,vrt.get_w(),vrt.get_h());
+ window->draw_vframe(&vlt, cx,cy, cdx,cdy, ox1,oy1, ow,oh); cx += cw;
+ window->draw_vframe(&vrt, cx,cy, cdx,cdy, ox1,oy1, ow,oh);
window->flash(1);
mwindow->cwindow->gui->unlock_window();
break; }