From d935a4348d9d0284be0bb7a9ad001a6b406112c5 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 16 May 2020 16:10:50 +0200 Subject: 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. --- scene/resources/default_theme/default_theme.cpp | 33 +++++-------------------- 1 file changed, 6 insertions(+), 27 deletions(-) (limited to 'scene/resources') 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 make_stylebox(T p_src, float p_left, float p_top, fl } else { texture = Ref(memnew(ImageTexture)); Ref 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 static Ref make_icon(T p_src) { Ref texture(memnew(ImageTexture)); Ref 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; -- cgit v1.2.3