X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fvframe.C;h=293205821fc9090da5f1a4b136539cc26497c174;hb=5ec378f09aeeb646705fdb8035b39a186374fba0;hp=14794aa2b8aea07fb7a6e6eb64612238b3eef3fd;hpb=9fed7535470aa37781733db836068da3b4c17a0d;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/guicast/vframe.C b/cinelerra-5.1/guicast/vframe.C index 14794aa2..29320582 100644 --- a/cinelerra-5.1/guicast/vframe.C +++ b/cinelerra-5.1/guicast/vframe.C @@ -73,11 +73,6 @@ VFrameScene::~VFrameScene() } - - - - - //static BCCounter counter; VFramePng::VFramePng(unsigned char *png_data, double s) @@ -282,6 +277,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) { @@ -827,6 +824,8 @@ int VFramePng::read_png(const unsigned char *data, long sz, double xscale, doubl return 1; } int ww = w * xscale, hh = h * yscale; + if( ww < 1 ) ww = 1; + if( hh < 1 ) hh = 1; if( ww != w || hh != h ) { VFrame vframe(*this); reallocate(NULL, -1, 0, 0, 0, ww, hh, color_model, -1); @@ -913,10 +912,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; @@ -984,7 +983,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()