X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;ds=sidebyside;f=cinelerra-5.1%2Fcinelerra%2Fcanvas.C;h=3e7ee0be96c1e6427b9e2f8140cee1d891514368;hb=a4387a272874bd4ed9f010684976f336fa3d0190;hp=72d8a906544c86c63ab63b2f1d94ea5c9e675b93;hpb=e9a3c57c8d3bb4d79e76a4c3942f86a66d3c267e;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/canvas.C b/cinelerra-5.1/cinelerra/canvas.C index 72d8a906..3e7ee0be 100644 --- a/cinelerra-5.1/cinelerra/canvas.C +++ b/cinelerra-5.1/cinelerra/canvas.C @@ -1,7 +1,7 @@ /* * CINELERRA - * Copyright (C) 2008 Adam Williams + * Copyright (C) 2008-2017 Adam Williams * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -332,8 +332,8 @@ void Canvas::get_transfers(EDL *edl, float &canvas_x1, float &canvas_y1, float &canvas_x2, float &canvas_y2, int canvas_w, int canvas_h) { -// printf("Canvas::get_transfers %d %d\n", canvas_w, -// canvas_h); +//printf("Canvas::get_transfers %d canvas_w=%d canvas_h=%d\n", +// __LINE__, canvas_w, canvas_h); // automatic canvas size detection if(canvas_w < 0) canvas_w = get_canvas()->get_w(); if(canvas_h < 0) canvas_h = get_canvas()->get_h(); @@ -430,6 +430,11 @@ void Canvas::get_transfers(EDL *edl, { out_h = (int)(out_w / edl->get_aspect_ratio() + 0.5); canvas_y1 = canvas_h / 2 - out_h / 2; +// printf("Canvas::get_transfers %d canvas_h=%d out_h=%f canvas_y1=%f\n", +// __LINE__, +// canvas_h, +// out_h, +// canvas_y1); } canvas_x2 = canvas_x1 + out_w; canvas_y2 = canvas_y1 + out_h; @@ -459,7 +464,8 @@ void Canvas::get_transfers(EDL *edl, canvas_y1 = MAX(0, canvas_y1); canvas_x2 = MAX(canvas_x1, canvas_x2); canvas_y2 = MAX(canvas_y1, canvas_y2); -// printf("Canvas::get_transfers 2 %f,%f %f,%f -> %f,%f %f,%f\n", +// printf("Canvas::get_transfers %d %f,%f %f,%f -> %f,%f %f,%f\n", +// __LINE__, // output_x1, // output_y1, // output_x2, @@ -733,23 +739,8 @@ void Canvas::create_canvas() wdw->stop_video(); } - int x = subwindow->get_screen_x(0, -1); - int y = subwindow->get_screen_y(0, -1); - int w = root_w; - int h = root_h; - if( mwindow->screens == 1 && root_w > scr_w0 ) { - // Xinerama - if( subwindow->get_x() >= scr_w0 ) { - // assumes right side is the big one - w = root_w - scr_w0; - h = root_h; - } - else { - // use same aspect ratio to compute left height - w = scr_w0; - h = (w*root_h) / (root_w-scr_w0); - } - } + int x, y, w, h; + wdw->get_fullscreen_geometry(x, y, w, h); if( canvas_fullscreen ) { @@ -817,7 +808,6 @@ int Canvas::button_press_event_base(BC_WindowBase *caller) int Canvas::keypress_event(BC_WindowBase *caller) { - int caller_is_canvas = (caller == get_canvas()); int key = caller->get_keypress(); switch( key ) { case 'f': @@ -826,13 +816,13 @@ int Canvas::keypress_event(BC_WindowBase *caller) stop_fullscreen(); else start_fullscreen(); - if(!caller_is_canvas) caller->lock_window("Canvas::keypress_event 1"); + caller->lock_window("Canvas::keypress_event 1"); break; case ESC: caller->unlock_window(); if(get_fullscreen()) stop_fullscreen(); - if(!caller_is_canvas) caller->lock_window("Canvas::keypress_event 2"); + caller->lock_window("Canvas::keypress_event 2"); break; default: return 0; @@ -845,22 +835,25 @@ 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; + output_frame->get_opengl_state() != VFrame::RAM; // OpenGL does YUV->RGB in the compositing step if( use_opengl ) best_color_model = BC_RGB888; + int out_w = output_frame->get_w(); + int out_h = output_frame->get_h(); 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) ) { + (refresh_frame->get_w() != out_w || + refresh_frame->get_h() != out_h || + refresh_frame->get_color_model() != best_color_model ) ) { +// x11 direct render uses BC_BGR8888, use tranfer_from to remap delete refresh_frame; refresh_frame = 0; } if( !refresh_frame ) { refresh_frame = - new VFrame(device->out_w, device->out_h, best_color_model); + new VFrame(out_w, out_h, best_color_model); } if( use_opengl ) { @@ -876,6 +869,16 @@ void Canvas::update_refresh(VideoDevice *device, VFrame *output_frame) } +void Canvas::clear(int flush) +{ + if( refresh_frame ) + refresh_frame->clear_frame(); + BC_WindowBase *wdw = get_canvas(); + if( !wdw ) return; + wdw->set_bg_color(BLACK); + wdw->clear_box(0,0, wdw->get_w(), wdw->get_h()); + wdw->flash(flush); +} @@ -895,17 +898,17 @@ CanvasOutput::~CanvasOutput() int CanvasOutput::cursor_leave_event() { - return canvas->cursor_leave_event_base(this); + return canvas->cursor_leave_event_base(canvas->get_canvas()); } int CanvasOutput::cursor_enter_event() { - return canvas->cursor_enter_event_base(this); + return canvas->cursor_enter_event_base(canvas->get_canvas()); } int CanvasOutput::button_press_event() { - return canvas->button_press_event_base(this); + return canvas->button_press_event_base(canvas->get_canvas()); } int CanvasOutput::button_release_event() @@ -920,7 +923,7 @@ int CanvasOutput::cursor_motion_event() int CanvasOutput::keypress_event() { - return canvas->keypress_event(this); + return canvas->keypress_event(canvas->get_canvas()); } @@ -1152,7 +1155,7 @@ int CanvasPopupSize::handle_event() CanvasPopupResetCamera::CanvasPopupResetCamera(Canvas *canvas) - : BC_MenuItem(_("Reset camera")) + : BC_MenuItem(_("Reset camera"), "F11", KEY_F11) { this->canvas = canvas; } @@ -1165,7 +1168,7 @@ int CanvasPopupResetCamera::handle_event() CanvasPopupResetProjector::CanvasPopupResetProjector(Canvas *canvas) - : BC_MenuItem(_("Reset projector")) + : BC_MenuItem(_("Reset projector"), "F12", KEY_F12) { this->canvas = canvas; }