浏览代码

Fix square image resize

Fixes #37980

(cherry picked from commit d45e8734d18dd17bd5726dbb1db8fde9be1022ea)
Vasiliy Makarov 5 年之前
父节点
当前提交
982dee67f0
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      core/image.cpp

+ 3 - 0
core/image.cpp

@@ -869,6 +869,9 @@ void Image::resize_to_po2(bool p_square) {
 
 	int w = next_power_of_2(width);
 	int h = next_power_of_2(height);
+	if (p_square) {
+		w = h = MAX(w, h);
+	}
 
 	if (w == width && h == height) {