X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fsvg%2Fsvg.C;h=842161aef515a863ec2597a2c5b5ec324373c2d6;hp=c80bf199ab2c856a303d1a45d8c334dc237dfd8a;hb=77815ec03df6a03ed75433e8cf8ae1e83fb76d6e;hpb=d85ee0843fbbd79a0a7d2ffa0aac57968e24f6d7 diff --git a/cinelerra-5.1/plugins/svg/svg.C b/cinelerra-5.1/plugins/svg/svg.C index c80bf199..842161ae 100644 --- a/cinelerra-5.1/plugins/svg/svg.C +++ b/cinelerra-5.1/plugins/svg/svg.C @@ -190,29 +190,17 @@ int SvgMain::process_realtime(VFrame *input, VFrame *output) printf(_("Export of %s to %s failed\n"), config.svg_file, filename_png); } if( fd >= 0 ) { - struct stat st_png; - fstat(fd, &st_png); - unsigned char *png_buffer = (unsigned char *) - mmap (NULL, st_png.st_size, PROT_READ, MAP_SHARED, fd, 0); - if( png_buffer != MAP_FAILED ) { - if( png_buffer[0] == 0x89 && png_buffer[1] == 0x50 && - png_buffer[2] == 0x4e && png_buffer[3] == 0x47 ) { - ofrm = new VFramePng(png_buffer, st_png.st_size, 1., 1.); - if( ofrm->get_color_model() != output->get_color_model() ) { - VFrame *vfrm = new VFrame(ofrm->get_w(), ofrm->get_h(), - output->get_color_model()); - vfrm->transfer_from(ofrm); - delete ofrm; ofrm = vfrm; - } - } - else - printf (_("The file %s that was generated from %s is not in PNG format." - " Try to delete all *.png files.\n"), filename_png, config.svg_file); - munmap(png_buffer, st_png.st_size); - } - else - printf(_("Access mmap to %s as %s failed.\n"), config.svg_file, filename_png); + ofrm = VFramePng::vframe_png(fd); close(fd); + if( ofrm && ofrm->get_color_model() != output->get_color_model() ) { + VFrame *vfrm = new VFrame(ofrm->get_w(), ofrm->get_h(), + output->get_color_model()); + vfrm->transfer_from(ofrm); + delete ofrm; ofrm = vfrm; + } + if( !ofrm ) + printf (_("The file %s that was generated from %s is not in PNG format." + " Try to delete all *.png files.\n"), filename_png, config.svg_file); } } if( ofrm ) {