From 7a4d67ae7129ee92feebea3d5f7b46d456d29f88 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 18 Jul 2016 18:30:30 -0300 Subject: Property convert images to RGBA before applying hq2x, fixes #5168 --- scene/resources/default_theme/default_theme.cpp | 8 ++++++-- tools/editor/icons/SCsub | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index ffc5232e8f..499cf0a169 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -54,8 +54,10 @@ static Ref make_stylebox(T p_src,float p_left, float p_top, flo texture = Ref( memnew( ImageTexture ) ); Image img(p_src); - if (scale>1) + if (scale>1) { + img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); + } texture->create_from_image( img,ImageTexture::FLAG_FILTER ); (*tex_cache)[p_src]=texture; } @@ -92,8 +94,10 @@ static Ref make_icon(T p_src) { Ref texture( memnew( ImageTexture ) ); Image img = Image(p_src); - if (scale>1) + if (scale>1) { + img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); + } texture->create_from_image( img,ImageTexture::FLAG_FILTER ); return texture; diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index 7132968c88..f2f5dcca48 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -65,7 +65,7 @@ def make_editor_icons_action(target, source, env): s.write("static Ref make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") s.write("\tRef texture( memnew( ImageTexture ) );\n") s.write("\tImage img((editor_is_hidpi()&&p_hidpi_png)?p_hidpi_png:p_png);\n") - s.write("\tif (editor_is_hidpi() && !p_hidpi_png) img.expand_x2_hq2x();\n") + s.write("\tif (editor_is_hidpi() && !p_hidpi_png) { img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); }\n") s.write("\ttexture->create_from_image( img,ImageTexture::FLAG_FILTER );\n") s.write("\treturn texture;\n") s.write("}\n\n") -- cgit v1.2.3