Import: Cleanup and optimize etcpak compression method

Avoid unnecessary allocation of temporary buffers for each mip, and creates
only one Image with the compressed data.
Also renames variable and reorders code for clarity.

Clarify that squish is now only used for decompression.

Documented which formats can be decompressed in Image.
This commit is contained in:
Rémi Verschelde
2021-04-15 14:02:45 +02:00
parent 2e87857d75
commit 0ab928e060
9 changed files with 108 additions and 85 deletions

View File

@ -1,5 +1,5 @@
/*************************************************************************/
/* image_compress_squish.cpp */
/* image_decompress_squish.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "image_compress_squish.h"
#include "image_decompress_squish.h"
#include <squish.h>

View File

@ -1,5 +1,5 @@
/*************************************************************************/
/* image_compress_squish.h */
/* image_decompress_squish.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef IMAGE_COMPRESS_SQUISH_H
#define IMAGE_COMPRESS_SQUISH_H
#ifndef IMAGE_DECOMPRESS_SQUISH_H
#define IMAGE_DECOMPRESS_SQUISH_H
#include "core/io/image.h"
void image_decompress_squish(Image *p_image);
#endif // IMAGE_COMPRESS_SQUISH_H
#endif // IMAGE_DECOMPRESS_SQUISH_H

View File

@ -29,7 +29,8 @@
/*************************************************************************/
#include "register_types.h"
#include "image_compress_squish.h"
#include "image_decompress_squish.h"
void register_squish_types() {
Image::_image_decompress_bc = image_decompress_squish;