diff options
author | Maganty Rushyendra <mrushyendra@yahoo.com.sg> | 2020-06-18 16:38:45 +0800 |
---|---|---|
committer | Maganty Rushyendra <mrushyendra@yahoo.com.sg> | 2020-06-18 17:21:42 +0800 |
commit | c7a8dc7bb9959f3822480f8fe00146ff7fcb3f30 (patch) | |
tree | ea9d7ed819397db245ad4e8eaa6d628670dbf0e1 /editor/plugins | |
parent | d341181f30b4f2e154748911f5d8a59b43aa6e62 (diff) |
Fix editor texture preview for certain specific dimensions
Ensures no error is issued when attempting to preview a resource that
may be scaled down to <1 pixel when resizing to fit the thumbnail.
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 9cb167b41c..2889cb50a0 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -127,7 +127,8 @@ Ref<Texture2D> EditorTexturePreviewPlugin::generate(const RES &p_from, const Siz if (new_size.y > p_size.y) { new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y); } - img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC); + Vector2i new_size_i(MAX(1, (int)new_size.x), MAX(1, (int)new_size.y)); + img->resize(new_size_i.x, new_size_i.y, Image::INTERPOLATE_CUBIC); post_process_preview(img); |