X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fvframe.C;h=4c1aa390393a868c9f069396db3f2c7db95a05f4;hb=e620b69f6d3f1de30d8b2a16c46d7729462e5211;hp=76d6ae1d0e024521626e5143ab75a0ab9b5dfe8f;hpb=e41864cf7931bfb86f68c5d35d4578dfe161d386;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/guicast/vframe.C b/cinelerra-5.1/guicast/vframe.C index 76d6ae1d..4c1aa390 100644 --- a/cinelerra-5.1/guicast/vframe.C +++ b/cinelerra-5.1/guicast/vframe.C @@ -282,6 +282,8 @@ int VFrame::reset_parameters(int do_opengl) pixel_rgb = 0x000000; // BLACK pixel_yuv = 0x008080; stipple = 0; + clear_color = 0x000000; + clear_alpha = 0x00; if(do_opengl) { @@ -390,7 +392,8 @@ int VFrame::get_keyframe() void VFrame::get_temp(VFrame *&vfrm, int w, int h, int color_model) { - if( vfrm && ( vfrm->get_w() != w || vfrm->get_h() != h ) ) { + if( vfrm && ( vfrm->color_model != color_model || + vfrm->get_w() != w || vfrm->get_h() != h ) ) { delete vfrm; vfrm = 0; } if( !vfrm ) vfrm = new VFrame(w, h, color_model, 0); @@ -912,10 +915,10 @@ void VFrame::write_ppm(VFrame *vfrm, const char *fmt, ...) } \ } -int VFrame::clear_frame() +void VFrame::black_frame() { int sz = w * h; -//printf("VFrame::clear_frame %d\n", __LINE__); +//printf("VFrame::black_frame %d\n", __LINE__); switch(color_model) { case BC_COMPRESSED: break; @@ -983,7 +986,24 @@ int VFrame::clear_frame() bzero(data, calculate_data_size(w, h, bytes_per_line, color_model)); break; } - return 0; +} + +void VFrame::set_clear_color(int color, int alpha) +{ + clear_color = color; + clear_alpha = alpha; +} +int VFrame::get_clear_color() { return clear_color; } +int VFrame::get_clear_alpha() { return clear_alpha; } + +void VFrame::clear_frame() +{ + if( clear_color >= 0 && + !BC_CModels::init_color(clear_color, clear_alpha, + get_rows(), get_color_model(), get_y(), get_u(), get_v(), + 0,0, get_w(),get_h(), get_bytes_per_line()) ) + return; + black_frame(); } void VFrame::rotate90() @@ -1169,7 +1189,8 @@ int VFrame::transfer_from(VFrame *that, int bg_color, int in_x, int in_y, int in timestamp = that->timestamp; copy_params(that); - if( this->get_color_model() == that->get_color_model() && + if( in_x == 0 && in_y == 0 && in_w == that->get_w() && in_h == that->get_h() && + bg_color == 0 && this->get_color_model() == that->get_color_model() && this->get_w() == that->get_w() && this->get_h() == that->get_h() && this->get_bytes_per_line() == that->get_bytes_per_line() ) return this->copy_from(that);