+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::RAM;
+
+// 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 &&
+ (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;
+ }