X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fcanvas.C;h=72d8a906544c86c63ab63b2f1d94ea5c9e675b93;hb=ddb2a20b7dbae022ea8394b60a97cbaea839ded9;hp=e749aa7a22b913a83522a6009c652abd988b7d48;hpb=6fd57106820e676e368399d16b925bdc78d34621;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/canvas.C b/cinelerra-5.1/cinelerra/canvas.C index e749aa7a..72d8a906 100644 --- a/cinelerra-5.1/cinelerra/canvas.C +++ b/cinelerra-5.1/cinelerra/canvas.C @@ -30,6 +30,8 @@ #include "mwindowgui.h" #include "mutex.h" #include "mwindow.h" +#include "playback3d.h" +#include "videodevice.h" #include "vframe.h" @@ -505,45 +507,23 @@ void Canvas::get_scrollbars(EDL *edl, } //printf("Canvas::get_scrollbars 1 %d %d\n", get_xscroll(), get_yscroll()); - if(use_scrollbars) - { + if( use_scrollbars ) { w_needed = edl->session->output_w; h_needed = edl->session->output_h; get_zooms(edl, 0, zoom_x, zoom_y, conformed_w, conformed_h); //printf("Canvas::get_scrollbars 2 %d %d\n", get_xscroll(), get_yscroll()); -// while(!done) -// { - w_visible = (int)(canvas_w / zoom_x); - h_visible = (int)(canvas_h / zoom_y); -// done = 1; - -// if(w_needed > w_visible) - if(1) - { - if(!need_xscroll) - { - need_xscroll = 1; - canvas_h -= BC_ScrollBar::get_span(SCROLL_HORIZ); -// done = 0; - } - } - else - need_xscroll = 0; + w_visible = (int)(canvas_w / zoom_x); + h_visible = (int)(canvas_h / zoom_y); + if( w_needed > w_visible ) { + need_xscroll = 1; + canvas_h -= BC_ScrollBar::get_span(SCROLL_HORIZ); + } -// if(h_needed > h_visible) - if(1) - { - if(!need_yscroll) - { - need_yscroll = 1; - canvas_w -= BC_ScrollBar::get_span(SCROLL_VERT); -// done = 0; - } - } - else - need_yscroll = 0; -// } + if( h_needed > h_visible ) { + need_yscroll = 1; + canvas_w -= BC_ScrollBar::get_span(SCROLL_VERT); + } //printf("Canvas::get_scrollbars %d %d %d %d %d %d\n", canvas_w, canvas_h, w_needed, h_needed, w_visible, h_visible); //printf("Canvas::get_scrollbars 3 %d %d\n", get_xscroll(), get_yscroll()); @@ -551,47 +531,41 @@ void Canvas::get_scrollbars(EDL *edl, h_visible = (int)(canvas_h / zoom_y); } - if(need_xscroll) - { - if(!xscroll) - { - subwindow->add_subwindow(xscroll = - new CanvasXScroll(edl, this, canvas_x, canvas_y + canvas_h, - w_needed, get_xscroll(), w_visible, canvas_w)); + if( need_xscroll ) { + if( !xscroll ) { + xscroll = new CanvasXScroll(edl, this, canvas_x, canvas_y + canvas_h, + w_needed, get_xscroll(), w_visible, canvas_w); + subwindow->add_subwindow(xscroll); xscroll->show_window(0); } else xscroll->reposition_window(canvas_x, canvas_y + canvas_h, canvas_w); - if(xscroll->get_length() != w_needed || - xscroll->get_handlelength() != w_visible) + if( xscroll->get_length() != w_needed || + xscroll->get_handlelength() != w_visible ) xscroll->update_length(w_needed, get_xscroll(), w_visible, 0); } - else - { - if( xscroll ) { delete xscroll; xscroll = 0; } + else if( xscroll ) { + delete xscroll; xscroll = 0; } //printf("Canvas::get_scrollbars 4 %d %d\n", get_xscroll(), get_yscroll()); - if(need_yscroll) - { - if(!yscroll) - { - subwindow->add_subwindow(yscroll = - new CanvasYScroll(edl, this, canvas_x + canvas_w, canvas_y, - h_needed, get_yscroll(), h_visible, canvas_h)); + if( need_yscroll ) { + if( !yscroll ) { + yscroll = new CanvasYScroll(edl, this, canvas_x + canvas_w, canvas_y, + h_needed, get_yscroll(), h_visible, canvas_h); + subwindow->add_subwindow(yscroll); yscroll->show_window(0); } else yscroll->reposition_window(canvas_x + canvas_w, canvas_y, canvas_h); - if(yscroll->get_length() != edl->session->output_h || - yscroll->get_handlelength() != h_visible) + if( yscroll->get_length() != edl->session->output_h || + yscroll->get_handlelength() != h_visible ) yscroll->update_length(h_needed, get_yscroll(), h_visible, 0); } - else - { - if( yscroll ) { delete yscroll; yscroll = 0; } + else if( yscroll ) { + delete yscroll; yscroll = 0; } //printf("Canvas::get_scrollbars 5 %d %d\n", get_xscroll(), get_yscroll()); } @@ -866,17 +840,40 @@ int Canvas::keypress_event(BC_WindowBase *caller) return 1; } +void Canvas::update_refresh(VideoDevice *device, VFrame *output_frame) +{ + int best_color_model = output_frame->get_color_model(); + int use_opengl = + device->out_config->driver == PLAYBACK_X11_GL && + output_frame->get_opengl_state() == VFrame::SCREEN; +// OpenGL does YUV->RGB in the compositing step + if( use_opengl ) + best_color_model = BC_RGB888; + if( refresh_frame && + (refresh_frame->get_w() != device->out_w || + refresh_frame->get_h() != device->out_h || + refresh_frame->get_color_model() != best_color_model) ) { + delete refresh_frame; refresh_frame = 0; + } + if( !refresh_frame ) { + refresh_frame = + new VFrame(device->out_w, device->out_h, best_color_model); + } + if( use_opengl ) { + get_canvas()->unlock_window(); + unlock_canvas(); - - - - - - + mwindow->playback_3d->copy_from(this, refresh_frame, output_frame, 0); + lock_canvas(" Canvas::output_refresh"); + get_canvas()->lock_window(" Canvas::output_refresh"); + } + else + refresh_frame->copy_from(output_frame); +}