diff options
author | kobewi <kobewi4e@gmail.com> | 2022-05-04 01:49:20 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-07-08 13:40:47 +0200 |
commit | d2900429e81175a9f48240b180f1d8e3ab52865c (patch) | |
tree | 9a22ed1cd2ecea275dac8e9420d7a1d56c661382 /platform/osx | |
parent | ca18a02e00f7009d084c55b7e9de17df634f3d47 (diff) |
Add static methods for creating Image and ImageTexture
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/display_server_osx.mm | 5 | ||||
-rw-r--r-- | platform/osx/export/export_plugin.cpp | 6 |
2 files changed, 3 insertions, 8 deletions
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index 4307685422..91d64b50f0 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -1178,10 +1178,7 @@ Ref<Texture2D> DisplayServerOSX::global_menu_get_item_icon(const String &p_menu_ GodotMenuItem *obj = [menu_item representedObject]; if (obj) { if (obj->img.is_valid()) { - Ref<ImageTexture> txt; - txt.instantiate(); - txt->create_from_image(obj->img); - return txt; + return ImageTexture::create_from_image(obj->img); } } } diff --git a/platform/osx/export/export_plugin.cpp b/platform/osx/export/export_plugin.cpp index 00a7e54131..a22d7e5e3d 100644 --- a/platform/osx/export/export_plugin.cpp +++ b/platform/osx/export/export_plugin.cpp @@ -252,7 +252,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_ if (icon_infos[i].is_png) { // Encode PNG icon. - it->create_from_image(copy); + it->set_image(copy); String path = EditorPaths::get_singleton()->get_cache_dir().plus_file("icon.png"); ResourceSaver::save(path, it); @@ -1666,9 +1666,7 @@ bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset } EditorExportPlatformOSX::EditorExportPlatformOSX() { - Ref<Image> img = memnew(Image(_osx_logo)); - logo.instantiate(); - logo->create_from_image(img); + logo = ImageTexture::create_from_image(memnew(Image(_osx_logo))); } EditorExportPlatformOSX::~EditorExportPlatformOSX() { |