From: Good Guy Date: Wed, 6 Nov 2019 23:00:38 +0000 (-0700) Subject: bg/clr color tweaks, clear borders rework, fc31 depends X-Git-Tag: 2019-11~7 X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=07af5297688e2f888e0a309eab76293093a003bb;p=goodguy%2Fcinelerra.git bg/clr color tweaks, clear borders rework, fc31 depends --- diff --git a/cinelerra-5.1/blds/bld_prepare.sh b/cinelerra-5.1/blds/bld_prepare.sh index 9c6f2dcd..0064bdfb 100755 --- a/cinelerra-5.1/blds/bld_prepare.sh +++ b/cinelerra-5.1/blds/bld_prepare.sh @@ -39,7 +39,7 @@ case "$dir" in # dnf group install "Development Tools" # ... lzma-sdk-devel libtool ... "fedora") - dnf install groups "Development Tools" + dnf group install "Development Tools" dnf -y --best --allowerasing \ install nasm yasm libavc1394-devel libusbx-devel flac-devel \ libjpeg-devel libdv-devel libdvdnav-devel libdvdread-devel \ @@ -51,7 +51,7 @@ case "$dir" in libpng-devel bzip2-devel zlib-devel kernel-headers libavc1394 \ festival-devel libdc1394-devel libiec61883-devel esound-devel \ flac-devel libsndfile-devel libtheora-devel linux-firmware \ - ivtv-firmware libvorbis-devel texinfo xz-devel lzma-devel cmake git \ + ivtv-firmware libvorbis-devel texinfo xz-devel cmake git \ ctags patch gcc-c++ perl-XML-XPath libtiff-devel python dvdauthor \ gettext-devel inkscape udftools autoconf automake numactl-devel \ jbigkit-devel libvdpau-devel libva-devel gtk2-devel mesa-vdpau-drivers diff --git a/cinelerra-5.1/cinelerra/canvas.C b/cinelerra-5.1/cinelerra/canvas.C index 125472ae..cd59b62c 100644 --- a/cinelerra-5.1/cinelerra/canvas.C +++ b/cinelerra-5.1/cinelerra/canvas.C @@ -898,17 +898,61 @@ void Canvas::update_refresh(VideoDevice *device, VFrame *output_frame) void Canvas::clear(int flash) { - BC_WindowBase *cwdw = get_canvas(); - if( !cwdw ) return; - cwdw->set_bg_color(get_clear_color()); - cwdw->clear_box(0,0, cwdw->get_w(), cwdw->get_h()); - if( flash ) cwdw->flash(); + BC_WindowBase *window = get_canvas(); + if( !window ) return; + window->set_bg_color(get_clear_color()); + window->clear_box(0,0, window->get_w(), window->get_h()); + if( flash ) window->flash(); +} + +void Canvas::clear_borders(EDL *edl) +{ + BC_WindowBase *window = get_canvas(); + if( !window ) return; + + int window_w = window->get_w(); + int window_h = window->get_h(); + float output_x1,output_y1, output_x2,output_y2; + float canvas_x1,canvas_y1, canvas_x2,canvas_y2; + get_transfers(edl, + output_x1, output_y1, output_x2, output_y2, + canvas_x1, canvas_y1, canvas_x2, canvas_y2); + int color = get_clear_color(); + window->set_color(color); + + if( canvas_y1 > 0 ) { + window->draw_box(0, 0, window_w, canvas_y1); + window->flash(0, 0, window_w, canvas_y1); + } + + if( canvas_y2 < window_h ) { + window->draw_box(0, canvas_y2, window_w, window_h-canvas_y2); + window->flash(0, canvas_y2, window_w, window_h-canvas_y2); + } + + if( canvas_x1 > 0 ) { + window->draw_box(0, canvas_y1, canvas_x1, canvas_y2-canvas_y1); + window->flash(0, canvas_y1, canvas_x1, canvas_y2-canvas_y1); + } + + if( canvas_x2 < window_w ) { + window->draw_box(canvas_x2, canvas_y1, + window_w-canvas_x2, canvas_y2-canvas_y1); + window->flash(canvas_x2, canvas_y1, + window_w-canvas_x2, canvas_y2-canvas_y1); + } } +int Canvas::get_clear_color() +{ + BC_WindowBase *cwdw = get_canvas(); + if( !cwdw ) return 0; + return cwdw->get_bg_color(); +} CanvasOutput::CanvasOutput(Canvas *canvas, int x, int y, int w, int h) - : BC_SubWindow(x, y, w, h, BLACK) + : BC_SubWindow(x, y, w, h, canvas->get_clear_color()) { this->canvas = canvas; } @@ -950,7 +994,7 @@ int CanvasOutput::keypress_event() CanvasFullScreen::CanvasFullScreen(Canvas *canvas, int w, int h) - : BC_FullScreen(canvas->subwindow, w, h, BLACK, 0, 0, 0) + : BC_FullScreen(canvas->subwindow, w, h, canvas->get_clear_color(), 0, 0, 0) { this->canvas = canvas; } diff --git a/cinelerra-5.1/cinelerra/canvas.h b/cinelerra-5.1/cinelerra/canvas.h index 53f6ee8b..8d30dccc 100644 --- a/cinelerra-5.1/cinelerra/canvas.h +++ b/cinelerra-5.1/cinelerra/canvas.h @@ -86,7 +86,7 @@ public: virtual void toggle_controls() {} virtual int get_cwindow_controls() { return 0; } virtual int get_fullscreen(); - virtual int get_clear_color() { return 0; } + virtual int get_clear_color(); virtual void set_fullscreen(int value); int cursor_leave_event_base(BC_WindowBase *caller); @@ -123,6 +123,7 @@ public: // Updates the stores virtual void update_zoom(int x, int y, float zoom) {}; void check_boundaries(EDL *edl, int &x, int &y, float &zoom); + void clear_borders(EDL *edl); void update_scrollbars(int flush); // Get scrollbar positions relative to output. // No correction is done if output is smaller than canvas diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 13ac058b..ebc6997e 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -3535,7 +3535,7 @@ int CWindowCanvas::get_cwindow_controls() int CWindowCanvas::get_clear_color() { int color = mwindow->edl->session->cwindow_clear_color; - if( color < 0 ) color = get_canvas()->get_bg_color(); + if( color < 0 ) color = Canvas::get_clear_color(); return color; } diff --git a/cinelerra-5.1/cinelerra/playback3d.C b/cinelerra-5.1/cinelerra/playback3d.C index 1844f808..295ce6fe 100644 --- a/cinelerra-5.1/cinelerra/playback3d.C +++ b/cinelerra-5.1/cinelerra/playback3d.C @@ -728,7 +728,11 @@ void Playback3D::draw_output(Playback3DCommand *command, int flip_y) if(!command->is_cleared) { // If we get here, the virtual console was not used. - color_frame(command, 0,0,0,0); + int color = command->canvas->get_clear_color(); + int r = (color>>16) & 0xff; // always rgb + int g = (color>>8) & 0xff; + int b = (color>>0) & 0xff; + color_frame(command, r/255.f, g/255.f, b/255.f, 0.f); } // Texture @@ -802,11 +806,14 @@ void Playback3D::clear_output_sync(Playback3DCommand *command) // Using pbuffer for refresh frame. if( command->frame ) { command->frame->enable_opengl(); + command->frame->set_opengl_state(VFrame::SCREEN); color = command->frame->get_clear_color(); alpha = command->frame->get_clear_alpha(); int color_model = command->canvas->mwindow->edl->session->color_model; is_yuv = BC_CModels::is_yuv(color_model); } + else + color = command->canvas->get_clear_color(); int a = alpha; int r = (color>>16) & 0xff; int g = (color>>8) & 0xff; diff --git a/cinelerra-5.1/cinelerra/playbackengine.C b/cinelerra-5.1/cinelerra/playbackengine.C index fcbeeb1d..917e0470 100644 --- a/cinelerra-5.1/cinelerra/playbackengine.C +++ b/cinelerra-5.1/cinelerra/playbackengine.C @@ -41,6 +41,8 @@ #include "mainsession.h" #include "trackcanvas.h" #include "transportque.h" +#include "videodevice.h" +#include "vdevicex11.h" #include "vrender.h" @@ -412,11 +414,7 @@ void PlaybackEngine::run() // Start tracking after arming so the tracking position doesn't change. // The tracking for a single frame command occurs during PAUSE init_tracking(); - if( !command->single_frame() ) { - EDL *edl = command->get_edl(); - if( edl && edl->tracks->playable_video_tracks() ) - clear_output(); - } + clear_borders(); // Dispatch the command start_render_engine(); break; @@ -425,13 +423,22 @@ void PlaybackEngine::run() } } -void PlaybackEngine::clear_output() +void PlaybackEngine::clear_borders() { - BC_WindowBase *cwdw = output->get_canvas(); - if( !cwdw ) return; - cwdw->lock_window("PlaybackEngine::clear_output"); - output->clear(); - cwdw->unlock_window(); + EDL *edl = command->get_edl(); + if( render_engine ) { + PlaybackConfig *config = edl->session->playback_config; + if( config->vconfig->driver == PLAYBACK_X11_GL ) { + VDeviceBase *vdriver = render_engine->video->get_output_base(); + ((VDeviceX11*)vdriver)->clear_output(); + return; + } + } + BC_WindowBase *window = output->get_canvas(); + if( !window ) return; + window->lock_window("PlaybackEngine::clear_output"); + output->clear_borders(edl); + window->unlock_window(); } void PlaybackEngine::stop_playback(int wait_tracking) diff --git a/cinelerra-5.1/cinelerra/playbackengine.h b/cinelerra-5.1/cinelerra/playbackengine.h index 048dc7a2..ed646b06 100644 --- a/cinelerra-5.1/cinelerra/playbackengine.h +++ b/cinelerra-5.1/cinelerra/playbackengine.h @@ -55,7 +55,7 @@ public: void create_cache(); void perform_change(); void sync_parameters(EDL *edl); - void clear_output(); + void clear_borders(); // Set wait_tracking for events that change the cursor location but // be sure to unlock the windows void interrupt_playback(int wait_tracking = 0); diff --git a/cinelerra-5.1/cinelerra/vdevicex11.C b/cinelerra-5.1/cinelerra/vdevicex11.C index 24d1be02..8db5af1f 100644 --- a/cinelerra-5.1/cinelerra/vdevicex11.C +++ b/cinelerra-5.1/cinelerra/vdevicex11.C @@ -283,35 +283,8 @@ void VDeviceX11::new_output_buffer(VFrame **result, int file_colormodel, EDL *ed delete bitmap; bitmap = 0; delete output_frame; output_frame = 0; // Clear borders if size changed - if( size_change ) { -//printf("VDeviceX11::new_output_buffer %d w=%d h=%d " -// "canvas_x1=%d canvas_y1=%d canvas_x2=%d canvas_y2=%d\n", -// __LINE__, // (int)output->w, (int)output->h, -// (int)canvas_x1, (int)canvas_y1, (int)canvas_x2, (int)canvas_y2); - window->set_color(BLACK); - - if( canvas_y1 > 0 ) { - window->draw_box(0, 0, output->w, canvas_y1); - window->flash(0, 0, output->w, canvas_y1); - } - - if( canvas_y2 < output->h ) { - window->draw_box(0, canvas_y2, output->w, output->h - canvas_y2); - window->flash(0, canvas_y2, output->w, output->h - canvas_y2); - } - - if( canvas_x1 > 0 ) { - window->draw_box(0, canvas_y1, canvas_x1, canvas_y2 - canvas_y1); - window->flash(0, canvas_y1, canvas_x1, canvas_y2 - canvas_y1); - } - - if( canvas_x2 < output->w ) { - window->draw_box(canvas_x2, canvas_y1, - output->w - canvas_x2, canvas_y2 - canvas_y1); - window->flash(canvas_x2, canvas_y1, - output->w - canvas_x2, canvas_y2 - canvas_y1); - } - } + if( size_change ) + output->clear_borders(edl); } } @@ -546,6 +519,7 @@ int VDeviceX11::write_buffer(VFrame *output_channels, EDL *edl) void VDeviceX11::clear_output() { is_cleared = 1; +// clear front and back buffers output->mwindow->playback_3d->clear_output(output, 0); output->mwindow->playback_3d->clear_output(output, output_frame); }