Skip to content

Commit

Permalink
Fix editor texture preview for certain specific dimensions
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit c7a8dc7)
  • Loading branch information
mrushyendra authored and akien-mga committed Jun 18, 2020
1 parent 88c22cb commit ae59e22
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion editor/plugins/editor_preview_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from, const Size2
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);

Expand Down

0 comments on commit ae59e22

Please sign in to comment.