diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-06-20 19:43:06 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-06-20 19:43:06 -0300 |
commit | 9d4cdc6d8a04cfbd543b5385f68e61dd1b33bd94 (patch) | |
tree | 3a9f51c1f64fae870c46769b39c32735e9f14df0 | |
parent | ad8d4a6b261277388433d72f6dbcea348ef0d0ca (diff) |
fix bug decompressing bc texture, closes #4404
-rw-r--r-- | core/image.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/core/image.cpp b/core/image.cpp index 57496683ef..e7f2694d35 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1735,8 +1735,17 @@ Error Image::_decompress_bc() { print_line("decompressing bc"); + int wd=width,ht=height; + if (wd%4!=0) { + wd+=4-(wd%4); + } + if (ht%4!=0) { + ht+=4-(ht%4); + } + + int mm; - int size = _get_dst_image_size(width,height,FORMAT_RGBA,mm,mipmaps); + int size = _get_dst_image_size(wd,ht,FORMAT_RGBA,mm,mipmaps); DVector<uint8_t> newdata; newdata.resize(size); @@ -1746,7 +1755,8 @@ Error Image::_decompress_bc() { int rofs=0; int wofs=0; - int wd=width,ht=height; + + print_line("width: "+itos(wd)+" height: "+itos(ht)); for(int i=0;i<=mm;i++) { @@ -2051,6 +2061,11 @@ Error Image::_decompress_bc() { data=newdata; format=FORMAT_RGBA; + if (wd!=width || ht!=height) { + //todo, crop + width=wd; + height=ht; + } return OK; } |