diff options
author | Juan Linietsky <juan@godotengine.org> | 2019-03-07 12:15:10 -0300 |
---|---|---|
committer | Juan Linietsky <juan@godotengine.org> | 2019-03-07 12:16:20 -0300 |
commit | 6cb841edcb1295a4877ed27330f0ba4c049ddafa (patch) | |
tree | a0ece323d1fe1277f1f3af788ecedbcf778fd31a /core | |
parent | e28e8490120d38f4b8d96c004075c239fce7ef80 (diff) |
Ensure ETC2 textures are ALSO compressed to Po2 when have mipmaps. Fixes #26733
Diffstat (limited to 'core')
-rw-r--r-- | core/image.cpp | 4 | ||||
-rw-r--r-- | core/image.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/core/image.cpp b/core/image.cpp index 5a287ca50e..f547d7e973 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -735,6 +735,10 @@ static void _overlay(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst, } } +bool Image::is_size_po2() const { + return uint32_t(width) == next_power_of_2(width) && uint32_t(height) == next_power_of_2(height); +} + void Image::resize_to_po2(bool p_square) { if (!_can_modify(format)) { diff --git a/core/image.h b/core/image.h index 872b84d565..69a42f169a 100644 --- a/core/image.h +++ b/core/image.h @@ -223,6 +223,7 @@ public: void resize(int p_width, int p_height, Interpolation p_interpolation = INTERPOLATE_BILINEAR); void shrink_x2(); void expand_x2_hq2x(); + bool is_size_po2() const; /** * Crop the image to a specific size, if larger, then the image is filled by black */ |