change composer to chroma only - no src alpha blend, resize about pref, new expanders...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / canvas.C
index 4f9d92344a882ea48bdb87f8ebce1825e0fc6b12..2b3953002d58cc03f8dc56321dd223baea9ede1e 100644 (file)
@@ -773,6 +773,10 @@ void Canvas::create_canvas()
 
        if(video_on) get_canvas()->start_video();
 
+       get_canvas()->lock_window("Canvas::create_canvas 2");
+       get_canvas()->focus();
+       get_canvas()->unlock_window();
+
        unlock_canvas();
 }
 
@@ -808,7 +812,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':
@@ -817,13 +820,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;
@@ -841,7 +844,16 @@ void Canvas::update_refresh(VideoDevice *device, VFrame *output_frame)
 // OpenGL does YUV->RGB in the compositing step
        if( use_opengl )
                best_color_model = BC_RGB888;
-
+       else if( BC_CModels::has_alpha(best_color_model) ) {
+               best_color_model =
+                       BC_CModels::is_float(best_color_model ) ?
+                               BC_RGB_FLOAT :
+                       BC_CModels::is_yuv(best_color_model ) ?
+                               ( BC_CModels::calculate_pixelsize(best_color_model) > 8 ?
+                                       BC_YUV161616 : BC_YUV888 ) :
+                               ( BC_CModels::calculate_pixelsize(best_color_model) > 8 ?
+                                       BC_RGB161616 : BC_RGB888 ) ;
+       }
        int out_w = output_frame->get_w();
        int out_h = output_frame->get_h();
        if( refresh_frame &&
@@ -866,7 +878,7 @@ void Canvas::update_refresh(VideoDevice *device, VFrame *output_frame)
                get_canvas()->lock_window(" Canvas::output_refresh");
        }
        else
-               refresh_frame->copy_from(output_frame);
+               refresh_frame->transfer_from(output_frame, -1);
 }
 
 
@@ -899,17 +911,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()
@@ -924,31 +936,13 @@ int CanvasOutput::cursor_motion_event()
 
 int CanvasOutput::keypress_event()
 {
-       return canvas->keypress_event(this);
+       return canvas->keypress_event(canvas->get_canvas());
 }
 
 
 
-
-
-
-
-
-
-
-
-
-
-CanvasFullScreen::CanvasFullScreen(Canvas *canvas,
-    int w,
-    int h)
- : BC_FullScreen(canvas->subwindow,
-       w,
-       h,
-       BLACK,
-       0,
-       0,
-       0)
+CanvasFullScreen::CanvasFullScreen(Canvas *canvas, int w, int h)
+ : BC_FullScreen(canvas->subwindow, w, h, BLACK, 0, 0, 0)
 {
        this->canvas = canvas;
 }
@@ -958,32 +952,9 @@ CanvasFullScreen::~CanvasFullScreen()
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-CanvasXScroll::CanvasXScroll(EDL *edl,
-       Canvas *canvas,
-    int x,
-    int y,
-       int length,
-       int position,
-       int handle_length,
-    int pixels)
- : BC_ScrollBar(x,
-               y,
-               SCROLL_HORIZ,
-               pixels,
-               length,
-               position,
-               handle_length)
+CanvasXScroll::CanvasXScroll(EDL *edl, Canvas *canvas, int x, int y,
+       int length, int position, int handle_length, int pixels)
+ : BC_ScrollBar(x, y, SCROLL_HORIZ, pixels, length, position, handle_length)
 {
        this->canvas = canvas;
 }
@@ -1001,25 +972,9 @@ int CanvasXScroll::handle_event()
 }
 
 
-
-
-
-
-CanvasYScroll::CanvasYScroll(EDL *edl,
-       Canvas *canvas,
-    int x,
-    int y,
-       int length,
-       int position,
-       int handle_length,
-    int pixels)
- : BC_ScrollBar(x,
-               y,
-               SCROLL_VERT,
-               pixels,
-               length,
-               position,
-               handle_length)
+CanvasYScroll::CanvasYScroll(EDL *edl, Canvas *canvas, int x, int y,
+       int length, int position, int handle_length, int pixels)
+ : BC_ScrollBar(x, y, SCROLL_VERT, pixels, length, position, handle_length)
 {
        this->canvas = canvas;
 }
@@ -1037,10 +992,6 @@ int CanvasYScroll::handle_event()
 }
 
 
-
-
-
-
 CanvasFullScreenPopup::CanvasFullScreenPopup(Canvas *canvas)
  : BC_PopupMenu(0, 0, 0, "", 0)
 {
@@ -1075,12 +1026,6 @@ int CanvasSubWindowItem::handle_event()
 }
 
 
-
-
-
-
-
-
 CanvasPopup::CanvasPopup(Canvas *canvas)
  : BC_PopupMenu(0, 0, 0, "", 0)
 {