From c362527cb5eea651d1332d3891166526df69ec51 Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Mon, 26 Aug 2019 18:21:19 +0300 Subject: [PATCH] Modify outdated comments and error messages regarding indexed images Godot doesn't support indexed images anymore (FORMAT_INDEXED), so those are removed to avoid any confusion. --- core/image.cpp | 12 ++++++------ core/image.h | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/core/image.cpp b/core/image.cpp index d8d667dbd50..900efb0eb05 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -863,7 +863,7 @@ bool Image::is_size_po2() const { void Image::resize_to_po2(bool p_square) { - ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot resize in indexed, compressed or custom image formats."); + ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot resize in compressed or custom image formats."); int w = next_power_of_2(width); int h = next_power_of_2(height); @@ -881,7 +881,7 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { ERR_FAIL_COND_MSG(data.size() == 0, "Cannot resize image before creating it, use create() or create_from_data() first."); - ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot resize in indexed, compressed or custom image formats."); + ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot resize in compressed or custom image formats."); bool mipmap_aware = p_interpolation == INTERPOLATE_TRILINEAR /* || p_interpolation == INTERPOLATE_TRICUBIC */; @@ -1094,7 +1094,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 indexed, compressed or custom image formats."); + ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot crop in compressed or custom image formats."); ERR_FAIL_COND(p_x < 0); ERR_FAIL_COND(p_y < 0); @@ -1149,7 +1149,7 @@ void Image::crop(int p_width, int p_height) { void Image::flip_y() { - ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot flip_y in indexed, compressed or custom image formats."); + ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot flip_y in compressed or custom image formats."); bool used_mipmaps = has_mipmaps(); if (used_mipmaps) { @@ -1182,7 +1182,7 @@ void Image::flip_y() { void Image::flip_x() { - ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot flip_x in indexed, compressed or custom image formats."); + ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot flip_x in compressed or custom image formats."); bool used_mipmaps = has_mipmaps(); if (used_mipmaps) { @@ -1441,7 +1441,7 @@ void Image::normalize() { Error Image::generate_mipmaps(bool p_renormalize) { - ERR_FAIL_COND_V_MSG(!_can_modify(format), ERR_UNAVAILABLE, "Cannot generate mipmaps in indexed, compressed or custom image formats."); + ERR_FAIL_COND_V_MSG(!_can_modify(format), ERR_UNAVAILABLE, "Cannot generate mipmaps in compressed or custom image formats."); ERR_FAIL_COND_V_MSG(width == 0 || height == 0, ERR_UNCONFIGURED, "Cannot generate mipmaps with width or height equal to 0."); diff --git a/core/image.h b/core/image.h index d17571399d9..f29a30cda0d 100644 --- a/core/image.h +++ b/core/image.h @@ -220,9 +220,7 @@ public: /** * Resize the image, using the preferred interpolation method. - * Indexed-Color images always use INTERPOLATE_NEAREST. */ - void resize_to_po2(bool p_square = false); void resize(int p_width, int p_height, Interpolation p_interpolation = INTERPOLATE_BILINEAR); void shrink_x2();