diff options
Diffstat (limited to 'core/image.cpp')
-rw-r--r-- | core/image.cpp | 50 |
1 files changed, 3 insertions, 47 deletions
diff --git a/core/image.cpp b/core/image.cpp index 29be2ff5eb..51216c8c31 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -37,8 +37,6 @@ #include "core/os/copymem.h" #include "core/print_string.h" -#include "thirdparty/misc/hq2x.h" - #include <stdio.h> const char *Image::format_names[Image::FORMAT_MAX] = { @@ -1445,47 +1443,6 @@ static void _generate_po2_mipmap(const Component *p_src, Component *p_dst, uint3 } } -void Image::expand_x2_hq2x() { - ERR_FAIL_COND(!_can_modify(format)); - - bool used_mipmaps = has_mipmaps(); - if (used_mipmaps) { - clear_mipmaps(); - } - - Format current = format; - - if (current != FORMAT_RGBA8) { - convert(FORMAT_RGBA8); - } - - Vector<uint8_t> dest; - dest.resize(width * 2 * height * 2 * 4); - - { - const uint8_t *r = data.ptr(); - uint8_t *w = dest.ptrw(); - - ERR_FAIL_COND(!r); - - hq2x_resize((const uint32_t *)r, width, height, (uint32_t *)w); - } - - width *= 2; - height *= 2; - data = dest; - - if (current != FORMAT_RGBA8) { - convert(current); - } - - // FIXME: This is likely meant to use "used_mipmaps" as defined above, but if we do, - // we end up with a regression: GH-22747 - if (mipmaps) { - generate_mipmaps(); - } -} - void Image::shrink_x2() { ERR_FAIL_COND(data.size() == 0); @@ -1993,7 +1950,7 @@ void Image::create(const char **p_xpm) { HashMap<String, Color> colormap; int colormap_size = 0; uint32_t pixel_size = 0; - uint8_t *w; + uint8_t *data_write = nullptr; while (status != DONE) { const char *line_ptr = p_xpm[line]; @@ -2089,7 +2046,7 @@ void Image::create(const char **p_xpm) { if (line == colormap_size) { status = READING_PIXELS; create(size_width, size_height, false, has_alpha ? FORMAT_RGBA8 : FORMAT_RGB8); - w = data.ptrw(); + data_write = data.ptrw(); pixel_size = has_alpha ? 4 : 3; } } break; @@ -2107,7 +2064,7 @@ void Image::create(const char **p_xpm) { for (uint32_t i = 0; i < pixel_size; i++) { pixel[i] = CLAMP((*colorptr)[i] * 255, 0, 255); } - _put_pixelb(x, y, pixel_size, w, pixel); + _put_pixelb(x, y, pixel_size, data_write, pixel); } if (y == (size_height - 1)) { @@ -3047,7 +3004,6 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("resize_to_po2", "square"), &Image::resize_to_po2, DEFVAL(false)); ClassDB::bind_method(D_METHOD("resize", "width", "height", "interpolation"), &Image::resize, DEFVAL(INTERPOLATE_BILINEAR)); ClassDB::bind_method(D_METHOD("shrink_x2"), &Image::shrink_x2); - ClassDB::bind_method(D_METHOD("expand_x2_hq2x"), &Image::expand_x2_hq2x); ClassDB::bind_method(D_METHOD("crop", "width", "height"), &Image::crop); ClassDB::bind_method(D_METHOD("flip_x"), &Image::flip_x); |