diff options
Diffstat (limited to 'modules/webp/image_loader_webp.cpp')
-rw-r--r-- | modules/webp/image_loader_webp.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 56fc386ef4..3508c6a663 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -36,9 +36,9 @@ #include <webp/decode.h> #include <webp/encode.h> -static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { +static PoolVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { - ERR_FAIL_COND_V(p_image.empty(),DVector<uint8_t>()); + ERR_FAIL_COND_V(p_image.empty(),PoolVector<uint8_t>()); Image img=p_image; if (img.detect_alpha()) @@ -47,8 +47,8 @@ static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { img.convert(Image::FORMAT_RGB8); Size2 s(img.get_width(),img.get_height()); - DVector<uint8_t> data = img.get_data(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t> data = img.get_data(); + PoolVector<uint8_t>::Read r = data.read(); uint8_t *dst_buff=NULL; size_t dst_size=0; @@ -59,25 +59,25 @@ static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { dst_size = WebPEncodeRGBA(r.ptr(),s.width,s.height,4*s.width,CLAMP(p_quality*100.0,0,100.0),&dst_buff); } - ERR_FAIL_COND_V(dst_size==0,DVector<uint8_t>()); - DVector<uint8_t> dst; + ERR_FAIL_COND_V(dst_size==0,PoolVector<uint8_t>()); + PoolVector<uint8_t> dst; dst.resize(4+dst_size); - DVector<uint8_t>::Write w = dst.write(); + PoolVector<uint8_t>::Write w = dst.write(); w[0]='W'; w[1]='E'; w[2]='B'; w[3]='P'; copymem(&w[4],dst_buff,dst_size); free(dst_buff); - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); return dst; } -static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { +static Image _webp_lossy_unpack(const PoolVector<uint8_t>& p_buffer) { int size = p_buffer.size()-4; ERR_FAIL_COND_V(size<=0,Image()); - DVector<uint8_t>::Read r = p_buffer.read(); + PoolVector<uint8_t>::Read r = p_buffer.read(); ERR_FAIL_COND_V(r[0]!='W' || r[1]!='E' || r[2]!='B' || r[3]!='P',Image()); WebPBitstreamFeatures features; @@ -90,11 +90,11 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { //print_line("height: "+itos(features.height)); //print_line("alpha: "+itos(features.has_alpha)); - DVector<uint8_t> dst_image; + PoolVector<uint8_t> dst_image; int datasize = features.width*features.height*(features.has_alpha?4:3); dst_image.resize(datasize); - DVector<uint8_t>::Write dst_w = dst_image.write(); + PoolVector<uint8_t>::Write dst_w = dst_image.write(); bool errdec=false; if (features.has_alpha) { @@ -107,7 +107,7 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { //ERR_EXPLAIN("Error decoding webp! - "+p_file); ERR_FAIL_COND_V(errdec,Image()); - dst_w = DVector<uint8_t>::Write(); + dst_w = PoolVector<uint8_t>::Write(); return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image); @@ -118,12 +118,12 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { uint32_t size = f->get_len(); - DVector<uint8_t> src_image; + PoolVector<uint8_t> src_image; src_image.resize(size); WebPBitstreamFeatures features; - DVector<uint8_t>::Write src_w = src_image.write(); + PoolVector<uint8_t>::Write src_w = src_image.write(); f->get_buffer(src_w.ptr(),size); ERR_FAIL_COND_V(f->eof_reached(), ERR_FILE_EOF); @@ -137,14 +137,14 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { print_line("height: "+itos(features.height)); print_line("alpha: "+itos(features.has_alpha)); - src_w = DVector<uint8_t>::Write(); + src_w = PoolVector<uint8_t>::Write(); - DVector<uint8_t> dst_image; + PoolVector<uint8_t> dst_image; int datasize = features.width*features.height*(features.has_alpha?4:3); dst_image.resize(datasize); - DVector<uint8_t>::Read src_r = src_image.read(); - DVector<uint8_t>::Write dst_w = dst_image.write(); + PoolVector<uint8_t>::Read src_r = src_image.read(); + PoolVector<uint8_t>::Write dst_w = dst_image.write(); bool errdec=false; @@ -158,8 +158,8 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { //ERR_EXPLAIN("Error decoding webp! - "+p_file); ERR_FAIL_COND_V(errdec,ERR_FILE_CORRUPT); - src_r = DVector<uint8_t>::Read(); - dst_w = DVector<uint8_t>::Write(); + src_r = PoolVector<uint8_t>::Read(); + dst_w = PoolVector<uint8_t>::Write(); *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image); |