- int len = get_plugin_png_path(png_path);
- if( !len ) return 0;
- int ret = 0, w = 0, h = 0;
- unsigned char *bfr = 0;
- int fd = ::open(png_path, O_RDONLY);
- if( fd < 0 ) ret = 1;
- if( !ret ) {
- bfr = (unsigned char *) ::mmap (NULL, len, PROT_READ, MAP_SHARED, fd, 0);
- if( bfr == MAP_FAILED ) ret = 1;
- }
- VFrame *vframe = 0;
- if( !ret ) {
- double scale = BC_WindowBase::get_resources()->icon_scale;
- vframe = new VFramePng(bfr, len, scale, scale);
- if( (w=vframe->get_w()) <= 0 || (h=vframe->get_h()) <= 0 ||
- vframe->get_data() == 0 ) ret = 1;
- }
- if( bfr && bfr != MAP_FAILED ) ::munmap(bfr, len);
- if( fd >= 0 ) ::close(fd);
- if( ret ) { delete vframe; vframe = 0; }
- return vframe;
+ if( !get_plugin_png_path(png_path) )
+ return VFramePng::vframe_png(png_path,0,0);
+ char png_name[BCSTRLEN];
+ get_plugin_png_name(png_name);
+ unsigned char *data = mwindow->theme->get_image_data(png_name, 0);
+ return data ? new VFramePng(data, 0.) : 0;