repair cpanel zoom
[goodguy/history.git] / cinelerra-5.1 / cinelerra / vdevicex11.C
index c0ca4b08357df010a1d85b04532b38ede2ece028..9db8bb831c45e24e332de2b3f75dc54887ae3997 100644 (file)
@@ -161,19 +161,7 @@ int VDeviceX11::close_all()
        if( output ) {
                output->lock_canvas("VDeviceX11::close_all 1");
                output->get_canvas()->lock_window("VDeviceX11::close_all 1");
-       }
-
-       if( output && output_frame ) {
-               output->update_refresh(device, output_frame);
-               if( device->single_frame )
-                       output->draw_refresh();
-       }
-
-       delete bitmap;          bitmap = 0;
-       delete output_frame;    output_frame = 0;
-       delete capture_bitmap;  capture_bitmap = 0;
-
-       if( output ) {
+               int video_on = output->get_canvas()->get_video_on();
 // Update the status bug
                if( !device->single_frame ) {
                        output->stop_video();
@@ -181,7 +169,19 @@ int VDeviceX11::close_all()
                else {
                        output->stop_single();
                }
+               if( output_frame ) {
+                       output->update_refresh(device, output_frame);
+// if the last frame is good, don't draw over it
+                       if( !video_on || output->need_overlays() )
+                               output->draw_refresh(1);
+               }
+       }
+
+       delete bitmap;          bitmap = 0;
+       delete output_frame;    output_frame = 0;
+       delete capture_bitmap;  capture_bitmap = 0;
 
+       if( output ) {
                output->get_canvas()->unlock_window();
                output->unlock_canvas();
        }
@@ -236,11 +236,11 @@ int VDeviceX11::get_display_colormodel(int file_colormodel)
 
        if( device->out_config->driver == PLAYBACK_X11_GL ) {
                if( file_colormodel == BC_RGB888 ||
-                       file_colormodel == BC_RGBA8888 ||
-                       file_colormodel == BC_YUV888 ||
-                       file_colormodel == BC_YUVA8888 ||
-                       file_colormodel == BC_RGB_FLOAT ||
-                       file_colormodel == BC_RGBA_FLOAT ) {
+                   file_colormodel == BC_RGBA8888 ||
+                   file_colormodel == BC_YUV888 ||
+                   file_colormodel == BC_YUVA8888 ||
+                   file_colormodel == BC_RGB_FLOAT ||
+                   file_colormodel == BC_RGBA_FLOAT ) {
                        return file_colormodel;
                }
                
@@ -257,13 +257,6 @@ int VDeviceX11::get_display_colormodel(int file_colormodel)
                }
        }
 
-// 2 more colormodels are supported by OpenGL
-       if( device->out_config->driver == PLAYBACK_X11_GL ) {
-               if( file_colormodel == BC_RGB_FLOAT ||
-                   file_colormodel == BC_RGBA_FLOAT )
-                       result = file_colormodel;
-       }
-
        if( result < 0 ) {
                switch( file_colormodel ) {
                case BC_RGB888:
@@ -583,27 +576,29 @@ int VDeviceX11::write_buffer(VFrame *output_channels, EDL *edl)
                        output->get_canvas()->lock_window("VDeviceX11::write_buffer 2");
                }
        }
-       else
-       if( bitmap->hardware_scaling() ) {
-               output->get_canvas()->draw_bitmap(bitmap, !device->single_frame,
-                       (int)canvas_x1, (int)canvas_y1,
-                       (int)(canvas_x2 - canvas_x1), (int)(canvas_y2 - canvas_y1),
-                       (int)output_x1, (int)output_y1,
-                       (int)(output_x2 - output_x1), (int)(output_y2 - output_y1),
-                       0);
-       }
        else {
+               if( bitmap->hardware_scaling() ) {
+                       output->get_canvas()->draw_bitmap(bitmap, !device->single_frame,
+                               (int)canvas_x1, (int)canvas_y1,
+                               (int)(canvas_x2 - canvas_x1), (int)(canvas_y2 - canvas_y1),
+                               (int)output_x1, (int)output_y1,
+                               (int)(output_x2 - output_x1), (int)(output_y2 - output_y1),
+                               0);
+               }
+               else {
 //printf("VDeviceX11::write_buffer %d x=%d y=%d w=%d h=%d\n", 
 // __LINE__, (int)canvas_x1, (int)canvas_y1,
 // output->get_canvas()->get_w(), output->get_canvas()->get_h());
-
-               output->get_canvas()->draw_bitmap(bitmap, !device->single_frame,
-                       (int)canvas_x1, (int)canvas_y1,
-                       (int)(canvas_x2 - canvas_x1), (int)(canvas_y2 - canvas_y1),
-                       0, 0, 
-                       (int)(canvas_x2 - canvas_x1), (int)(canvas_y2 - canvas_y1),
-                       0);
+                       output->get_canvas()->draw_bitmap(bitmap, !device->single_frame,
+                               (int)canvas_x1, (int)canvas_y1,
+                               (int)(canvas_x2 - canvas_x1), (int)(canvas_y2 - canvas_y1),
+                               0, 0,
+                               (int)(canvas_x2 - canvas_x1), (int)(canvas_y2 - canvas_y1),
+                               0);
 //printf("VDeviceX11::write_buffer %d bitmap=%p\n", __LINE__, bitmap);
+               }
+               if( !output->get_canvas()->get_video_on() )
+                       output->get_canvas()->flash(0);
        }
 
        output->get_canvas()->unlock_window();