From f141f747de7045dcc4cbb6643ce5c38393ab3625 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 16 Nov 2018 19:12:00 -0300 Subject: Fix Squish decompression, closes #18109 --- modules/squish/image_compress_squish.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index 26cb76011c..a08ac7bd28 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -64,12 +64,13 @@ void image_decompress_squish(Image *p_image) { return; } - int dst_ofs = 0; - for (int i = 0; i <= mm_count; i++) { int src_ofs = 0, mipmap_size = 0, mipmap_w = 0, mipmap_h = 0; p_image->get_mipmap_offset_size_and_dimensions(i, src_ofs, mipmap_size, mipmap_w, mipmap_h); - squish::DecompressImage(&wb[dst_ofs], mipmap_w, mipmap_h, &rb[src_ofs], squish_flags); + int dst_ofs = Image::get_image_mipmap_offset(p_image->get_width(), p_image->get_height(), target_format, i); + squish::DecompressImage(&wb[dst_ofs], w, h, &rb[src_ofs], squish_flags); + w >>= 1; + h >>= 1; } p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data); -- cgit v1.2.3