You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
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.
This commit is contained in:
@@ -127,7 +127,8 @@ Ref<Texture2D> EditorTexturePreviewPlugin::generate(const RES &p_from, const Siz
|
|||||||
if (new_size.y > p_size.y) {
|
if (new_size.y > p_size.y) {
|
||||||
new_size = Vector2(new_size.x * p_size.y / 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);
|
post_process_preview(img);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user