You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
fix bug decompressing bc texture, closes #4404
(cherry picked from commit 9d4cdc6d8a)
This commit is contained in:
committed by
Rémi Verschelde
parent
299b0102f0
commit
d1dbc7fe93
@@ -1697,8 +1697,17 @@ Error Image::_decompress_bc() {
|
|||||||
|
|
||||||
print_line("decompressing 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 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;
|
DVector<uint8_t> newdata;
|
||||||
newdata.resize(size);
|
newdata.resize(size);
|
||||||
@@ -1708,7 +1717,8 @@ Error Image::_decompress_bc() {
|
|||||||
|
|
||||||
int rofs=0;
|
int rofs=0;
|
||||||
int wofs=0;
|
int wofs=0;
|
||||||
int wd=width,ht=height;
|
|
||||||
|
print_line("width: "+itos(wd)+" height: "+itos(ht));
|
||||||
|
|
||||||
for(int i=0;i<=mm;i++) {
|
for(int i=0;i<=mm;i++) {
|
||||||
|
|
||||||
@@ -2013,6 +2023,11 @@ Error Image::_decompress_bc() {
|
|||||||
|
|
||||||
data=newdata;
|
data=newdata;
|
||||||
format=FORMAT_RGBA;
|
format=FORMAT_RGBA;
|
||||||
|
if (wd!=width || ht!=height) {
|
||||||
|
//todo, crop
|
||||||
|
width=wd;
|
||||||
|
height=ht;
|
||||||
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user