diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-05-16 16:10:50 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-05-16 16:10:50 +0200 |
commit | d935a4348d9d0284be0bb7a9ad001a6b406112c5 (patch) | |
tree | f224bd1a5ccfa8ce3928b811585ceebcbd47492e /core | |
parent | ac58372db824b74b8c4feb948434b924c573b847 (diff) |
Remove HQ2X and the `Image.expand_2x_hq2x()` method
As of Godot 3.0, HQ2X is no longer used to upscale the editor theme
and icons on hiDPI displays, which limited its effective uses.
HQ2X was also used to upscale the project theme when the "Use Hidpi"
project setting was enabled, but results were often less than ideal.
The new StyleBoxFlat and SVG support also make HQ2X less important
to have as a core feature.
This decreases binary sizes slightly (-150 KB on most platforms,
-212 KB on WebAssembly release).
This partially addresses #12419.
Diffstat (limited to 'core')
-rw-r--r-- | core/SCsub | 1 | ||||
-rw-r--r-- | core/image.cpp | 44 | ||||
-rw-r--r-- | core/image.h | 1 |
3 files changed, 0 insertions, 46 deletions
diff --git a/core/SCsub b/core/SCsub index d53988fae7..80a5f6b623 100644 --- a/core/SCsub +++ b/core/SCsub @@ -52,7 +52,6 @@ thirdparty_misc_sources = [ "r128.c", "smaz.c", # C++ sources - "hq2x.cpp", "pcg.cpp", "triangulator.cpp", "clipper.cpp", diff --git a/core/image.cpp b/core/image.cpp index f99e8a636f..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); @@ -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); diff --git a/core/image.h b/core/image.h index dbdfaa917b..53c203998e 100644 --- a/core/image.h +++ b/core/image.h @@ -235,7 +235,6 @@ public: void resize_to_po2(bool p_square = false); void resize(int p_width, int p_height, Interpolation p_interpolation = INTERPOLATE_BILINEAR); void shrink_x2(); - void expand_x2_hq2x(); bool is_size_po2() const; /** * Crop the image to a specific size, if larger, then the image is filled by black |