瀏覽代碼

Fix AtlasPacker ignoring semi-transparent pixels
Fixes #33106

Eric Rybicki 5 年之前
父節點
當前提交
439e0027ec
共有 2 個文件被更改,包括 2 次插入3 次删除
  1. 1 2
      core/image.cpp
  2. 1 1
      doc/classes/Image.xml

+ 1 - 2
core/image.cpp

@@ -2027,8 +2027,7 @@ Rect2 Image::get_used_rect() const {
 	for (int j = 0; j < height; j++) {
 		for (int i = 0; i < width; i++) {
 
-			bool opaque = get_pixel(i, j).a > 0.99;
-			if (!opaque)
+			if (!(get_pixel(i, j).a > 0))
 				continue;
 			if (i > maxx)
 				maxx = i;

+ 1 - 1
doc/classes/Image.xml

@@ -285,7 +285,7 @@
 			<return type="Rect2">
 			</return>
 			<description>
-				Returns a [Rect2] enclosing the visible portion of the image.
+				Returns a [Rect2] enclosing the visible portion of the image, considering each pixel with a non-zero alpha channel as visible.
 			</description>
 		</method>
 		<method name="get_width" qualifiers="const">