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 /scene | |
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 'scene')
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 67617a946f..f5b987e8df 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -52,20 +52,9 @@ static Ref<StyleBoxTexture> make_stylebox(T p_src, float p_left, float p_top, fl } else { texture = Ref<ImageTexture>(memnew(ImageTexture)); Ref<Image> img = memnew(Image(p_src)); - - if (scale > 1) { - Size2 orig_size = Size2(img->get_width(), img->get_height()); - - img->convert(Image::FORMAT_RGBA8); - img->expand_x2_hq2x(); - if (scale != 2.0) { - img->resize(orig_size.x * scale, orig_size.y * scale); - } - } else if (scale < 1) { - Size2 orig_size = Size2(img->get_width(), img->get_height()); - img->convert(Image::FORMAT_RGBA8); - img->resize(orig_size.x * scale, orig_size.y * scale); - } + const Size2 orig_size = Size2(img->get_width(), img->get_height()); + img->convert(Image::FORMAT_RGBA8); + img->resize(orig_size.x * scale, orig_size.y * scale); texture->create_from_image(img); (*tex_cache)[p_src] = texture; @@ -98,19 +87,9 @@ template <class T> static Ref<Texture2D> make_icon(T p_src) { Ref<ImageTexture> texture(memnew(ImageTexture)); Ref<Image> img = memnew(Image(p_src)); - if (scale > 1) { - Size2 orig_size = Size2(img->get_width(), img->get_height()); - - img->convert(Image::FORMAT_RGBA8); - img->expand_x2_hq2x(); - if (scale != 2.0) { - img->resize(orig_size.x * scale, orig_size.y * scale); - } - } else if (scale < 1) { - Size2 orig_size = Size2(img->get_width(), img->get_height()); - img->convert(Image::FORMAT_RGBA8); - img->resize(orig_size.x * scale, orig_size.y * scale); - } + const Size2 orig_size = Size2(img->get_width(), img->get_height()); + img->convert(Image::FORMAT_RGBA8); + img->resize(orig_size.x * scale, orig_size.y * scale); texture->create_from_image(img); return texture; |