summaryrefslogtreecommitdiff
path: root/modules/etc/image_etc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/etc/image_etc.cpp')
-rw-r--r--modules/etc/image_etc.cpp35
1 files changed, 13 insertions, 22 deletions
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
index f5c817c816..fbbc765bf2 100644
--- a/modules/etc/image_etc.cpp
+++ b/modules/etc/image_etc.cpp
@@ -31,10 +31,10 @@
#include "image_etc.h"
#include "Etc.h"
#include "EtcFilter.h"
-#include "image.h"
-#include "os/copymem.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/image.h"
+#include "core/os/copymem.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
static Image::Format _get_etc2_mode(Image::DetectChannels format) {
switch (format) {
@@ -47,13 +47,14 @@ static Image::Format _get_etc2_mode(Image::DetectChannels format) {
case Image::DETECTED_RGB:
return Image::FORMAT_ETC2_RGB8;
- default:
+ case Image::DETECTED_RGBA:
return Image::FORMAT_ETC2_RGBA8;
- // TODO: would be nice if we could use FORMAT_ETC2_RGB8A1 for FORMAT_RGBA5551
+ // TODO: would be nice if we could use FORMAT_ETC2_RGB8A1 for FORMAT_RGBA5551
+ default:
+ // TODO: Kept for compatibility, but should be investigated whether it's correct or if it should error out
+ return Image::FORMAT_ETC2_RGBA8;
}
-
- ERR_FAIL_COND_V(true, Image::FORMAT_MAX);
}
static Etc::Image::Format _image_format_to_etc2comp_format(Image::Format format) {
@@ -81,17 +82,10 @@ static Etc::Image::Format _image_format_to_etc2comp_format(Image::Format format)
case Image::FORMAT_ETC2_RGB8A1:
return Etc::Image::Format::RGB8A1;
- }
-
- ERR_FAIL_COND_V(true, Etc::Image::Format::UNKNOWN);
-}
-
-static void _decompress_etc1(Image *p_img) {
- // not implemented, to be removed
-}
-static void _decompress_etc2(Image *p_img) {
- // not implemented, to be removed
+ default:
+ ERR_FAIL_V(Etc::Image::Format::UNKNOWN);
+ }
}
static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_format, Image::CompressSource p_source) {
@@ -174,7 +168,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
PoolVector<uint8_t>::Read r = img->get_data().read();
- int target_size = Image::get_image_data_size(imgw, imgh, etc_format, p_img->has_mipmaps());
+ unsigned int target_size = Image::get_image_data_size(imgw, imgh, etc_format, p_img->has_mipmaps());
int mmc = 1 + (p_img->has_mipmaps() ? Image::get_image_required_mipmaps(imgw, imgh, etc_format) : 0);
PoolVector<uint8_t> dst_data;
@@ -243,8 +237,5 @@ static void _compress_etc2(Image *p_img, float p_lossy_quality, Image::CompressS
void _register_etc_compress_func() {
Image::_image_compress_etc1_func = _compress_etc1;
- //Image::_image_decompress_etc1 = _decompress_etc1;
-
Image::_image_compress_etc2_func = _compress_etc2;
- //Image::_image_decompress_etc2 = _decompress_etc2;
}