diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-07-27 10:23:24 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-11 11:53:29 +0100 |
commit | 0586e184490fd132f99acb1a67c788959cfdbade (patch) | |
tree | 194972ba608705445c9ee084f908e183a9792760 /core/image.cpp | |
parent | 8bbbb973361f367a4888629c571fb6f43581269d (diff) | |
download | redot-engine-0586e184490fd132f99acb1a67c788959cfdbade.tar.gz |
Custom material support seems complete.
Diffstat (limited to 'core/image.cpp')
-rw-r--r-- | core/image.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/core/image.cpp b/core/image.cpp index 09b07bba13..6283b93f25 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1215,7 +1215,7 @@ void Image::flip_x() { } } -int Image::_get_dst_image_size(int p_width, int p_height, Format p_format, int &r_mipmaps, int p_mipmaps) { +int Image::_get_dst_image_size(int p_width, int p_height, Format p_format, int &r_mipmaps, int p_mipmaps, int *r_mm_width, int *r_mm_height) { int size = 0; int w = p_width; @@ -1242,6 +1242,13 @@ int Image::_get_dst_image_size(int p_width, int p_height, Format p_format, int & size += s; + if (r_mm_width) { + *r_mm_width = bw; + } + if (r_mm_height) { + *r_mm_height = bh; + } + if (p_mipmaps >= 0 && mm == p_mipmaps) break; @@ -1914,6 +1921,13 @@ int Image::get_image_required_mipmaps(int p_width, int p_height, Format p_format return mm; } +Size2i Image::get_image_mipmap_size(int p_width, int p_height, Format p_format, int p_mipmap) { + int mm; + Size2i ret; + _get_dst_image_size(p_width, p_height, p_format, mm, p_mipmap, &ret.x, &ret.y); + return ret; +} + int Image::get_image_mipmap_offset(int p_width, int p_height, Format p_format, int p_mipmap) { if (p_mipmap <= 0) { |