summaryrefslogtreecommitdiff
path: root/modules/squish
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-06-16 21:47:28 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-06-16 21:49:37 -0300
commitb19225bfce3dab39f8ce6b1ecf610ea0ba650f99 (patch)
tree7946e6eabae1c679a404a9146343fe2b6f2672b7 /modules/squish
parent8a03a29233d5ef4cf5be3aeebd76cb77c82bc983 (diff)
-Fix freezes caused by etccomp2, closes #9183
-Normalmaps are now detected and imported as RGTC, both in S3TC and ETC2, this improves their quality.
Diffstat (limited to 'modules/squish')
-rw-r--r--modules/squish/image_compress_squish.cpp9
-rw-r--r--modules/squish/image_compress_squish.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index 32772e0cd2..efce76c805 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -80,7 +80,7 @@ void image_decompress_squish(Image *p_image) {
p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
}
-void image_compress_squish(Image *p_image, bool p_srgb) {
+void image_compress_squish(Image *p_image, Image::CompressSource p_source) {
if (p_image->get_format() >= Image::FORMAT_DXT1)
return; //do not compress, already compressed
@@ -97,11 +97,16 @@ void image_compress_squish(Image *p_image, bool p_srgb) {
p_image->convert(Image::FORMAT_RGBA8); //still uses RGBA to convert
- if (p_srgb && (dc == Image::DETECTED_R || dc == Image::DETECTED_RG)) {
+ if (p_source == Image::COMPRESS_SOURCE_SRGB && (dc == Image::DETECTED_R || dc == Image::DETECTED_RG)) {
//R and RG do not support SRGB
dc = Image::DETECTED_RGB;
}
+ if (p_source == Image::COMPRESS_SOURCE_NORMAL) {
+ //R and RG do not support SRGB
+ dc = Image::DETECTED_RG;
+ }
+
switch (dc) {
case Image::DETECTED_L: {
diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h
index 8d859b8e0b..68aaeefc30 100644
--- a/modules/squish/image_compress_squish.h
+++ b/modules/squish/image_compress_squish.h
@@ -32,7 +32,7 @@
#include "image.h"
-void image_compress_squish(Image *p_image, bool p_srgb);
+void image_compress_squish(Image *p_image, Image::CompressSource p_source);
void image_decompress_squish(Image *p_image);
#endif // IMAGE_COMPRESS_SQUISH_H