diff --git a/core/image.cpp b/core/image.cpp index 15ae7db3997..7c5ad5e8194 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1104,7 +1104,7 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) { ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot crop in compressed or custom image formats."); - + ERR_FAIL_COND_MSG(write_lock.ptr(), "Cannot modify image when it is locked."); ERR_FAIL_COND_MSG(p_x < 0, "Start x position cannot be smaller than 0."); ERR_FAIL_COND_MSG(p_y < 0, "Start y position cannot be smaller than 0."); ERR_FAIL_COND_MSG(p_width <= 0, "Width of image must be greater than 0."); @@ -1351,7 +1351,8 @@ void Image::expand_x2_hq2x() { } void Image::shrink_x2() { - + ERR_FAIL_COND(!_can_modify(format)); + ERR_FAIL_COND_MSG(write_lock.ptr(), "Cannot modify image when it is locked."); ERR_FAIL_COND(data.size() == 0); if (mipmaps) { @@ -1455,6 +1456,8 @@ Error Image::generate_mipmaps(bool p_renormalize) { ERR_FAIL_COND_V_MSG(!_can_modify(format), ERR_UNAVAILABLE, "Cannot generate mipmaps in compressed or custom image formats."); + ERR_FAIL_COND_V_MSG(write_lock.ptr(), ERR_UNAVAILABLE, "Cannot modify image when it is locked."); + ERR_FAIL_COND_V_MSG(format == FORMAT_RGBA4444 || format == FORMAT_RGBA5551, ERR_UNAVAILABLE, "Cannot generate mipmaps in custom image formats."); ERR_FAIL_COND_V_MSG(width == 0 || height == 0, ERR_UNCONFIGURED, "Cannot generate mipmaps with width or height equal to 0."); @@ -3020,6 +3023,8 @@ void Image::premultiply_alpha() { } void Image::fix_alpha_edges() { + ERR_FAIL_COND(!_can_modify(format)); + ERR_FAIL_COND_MSG(write_lock.ptr(), "Cannot modify image when it is locked."); if (data.size() == 0) return;