diff options
-rw-r--r-- | core/image.cpp | 3 | ||||
-rw-r--r-- | doc/classes/Image.xml | 2 | ||||
-rw-r--r-- | editor/find_in_files.cpp | 4 |
3 files changed, 4 insertions, 5 deletions
diff --git a/core/image.cpp b/core/image.cpp index 672f850a1f..18d0653bae 100644 --- a/core/image.cpp +++ b/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; diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index 612b9ed3f5..8e16d4cb7d 100644 --- a/doc/classes/Image.xml +++ b/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"> diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 86a4a9ef47..4ab90ad3e4 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -828,8 +828,8 @@ void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector<Result> // If there are unsaved changes, the user will be asked on focus, // however that means either losing changes or losing replaces. - FileAccess *f = FileAccess::open(fpath, FileAccess::READ); - ERR_FAIL_COND_MSG(f == NULL, "Cannot open file from path '" + fpath + "'."); + FileAccessRef f = FileAccess::open(fpath, FileAccess::READ); + ERR_FAIL_COND_MSG(!f, "Cannot open file from path '" + fpath + "'."); String buffer; int current_line = 1; |