summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp15
-rw-r--r--main/tests/test_containers.cpp12
-rw-r--r--main/tests/test_image.cpp5
-rw-r--r--main/tests/test_physics_2d.cpp10
4 files changed, 13 insertions, 29 deletions
diff --git a/main/main.cpp b/main/main.cpp
index ea7d8e075c..e13fb8d3db 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -917,18 +917,19 @@ Error Main::setup2() {
bool boot_logo_scale = GLOBAL_DEF("application/boot_splash_fullsize", true);
GlobalConfig::get_singleton()->set_custom_property_info("application/boot_splash", PropertyInfo(Variant::STRING, "application/boot_splash", PROPERTY_HINT_FILE, "*.png"));
- Image boot_logo;
+ Ref<Image> boot_logo;
boot_logo_path = boot_logo_path.strip_edges();
if (boot_logo_path != String() /*&& FileAccess::exists(boot_logo_path)*/) {
print_line("Boot splash path: " + boot_logo_path);
- Error err = boot_logo.load(boot_logo_path);
+ boot_logo.instance();
+ Error err = boot_logo->load(boot_logo_path);
if (err)
ERR_PRINTS("Non-existing or invalid boot splash at: " + boot_logo_path + ". Loading default splash.");
}
- if (!boot_logo.empty()) {
+ if (boot_logo.is_valid()) {
OS::get_singleton()->_msec_splash = OS::get_singleton()->get_ticks_msec();
Color boot_bg = GLOBAL_DEF("application/boot_bg_color", clear);
VisualServer::get_singleton()->set_boot_image(boot_logo, boot_bg, boot_logo_scale);
@@ -941,7 +942,7 @@ Error Main::setup2() {
#ifndef NO_DEFAULT_BOOT_LOGO
MAIN_PRINT("Main: Create bootsplash");
- Image splash(boot_splash_png);
+ Ref<Image> splash = memnew(Image(boot_splash_png));
MAIN_PRINT("Main: ClearColor");
VisualServer::get_singleton()->set_default_clear_color(boot_splash_bg_color);
@@ -950,7 +951,7 @@ Error Main::setup2() {
#endif
}
- Image icon(app_icon_png);
+ Ref<Image> icon = memnew(Image(app_icon_png));
OS::get_singleton()->set_icon(icon);
}
@@ -1464,8 +1465,8 @@ bool Main::start() {
String iconpath = GLOBAL_DEF("application/icon", "Variant()");
if (iconpath != "") {
- Image icon;
- if (icon.load(iconpath) == OK)
+ Ref<Image> icon;
+ if (icon->load(iconpath) == OK)
OS::get_singleton()->set_icon(icon);
}
}
diff --git a/main/tests/test_containers.cpp b/main/tests/test_containers.cpp
index 890599385a..956be5d169 100644
--- a/main/tests/test_containers.cpp
+++ b/main/tests/test_containers.cpp
@@ -55,18 +55,6 @@ MainLoop *test() {
{
- Image img;
- img.create(default_mouse_cursor_xpm);
-
- {
- for (int i = 0; i < 8; i++) {
-
- Image mipmap;
- //img.make_mipmap(mipmap);
- img = mipmap;
- if (img.get_width() <= 4) break;
- };
- };
};
#if 0
diff --git a/main/tests/test_image.cpp b/main/tests/test_image.cpp
index aff3bae417..c2c742e75d 100644
--- a/main/tests/test_image.cpp
+++ b/main/tests/test_image.cpp
@@ -63,11 +63,6 @@ public:
MainLoop *test() {
- Image img;
- ImageLoader::load_image("as1.png", &img);
-
- img.resize(512, 512);
-
return memnew(TestMainLoop);
}
}
diff --git a/main/tests/test_physics_2d.cpp b/main/tests/test_physics_2d.cpp
index 1476e45fcc..d8a00a589a 100644
--- a/main/tests/test_physics_2d.cpp
+++ b/main/tests/test_physics_2d.cpp
@@ -82,7 +82,7 @@ class TestPhysics2DMainLoop : public MainLoop {
}
}
- Image image(32, 2, 0, Image::FORMAT_LA8, pixels);
+ Ref<Image> image = memnew(Image(32, 2, 0, Image::FORMAT_LA8, pixels));
body_shape_data[Physics2DServer::SHAPE_SEGMENT].image = vs->texture_create_from_image(image);
@@ -109,7 +109,7 @@ class TestPhysics2DMainLoop : public MainLoop {
}
}
- Image image(32, 32, 0, Image::FORMAT_LA8, pixels);
+ Ref<Image> image = memnew(Image(32, 32, 0, Image::FORMAT_LA8, pixels));
body_shape_data[Physics2DServer::SHAPE_CIRCLE].image = vs->texture_create_from_image(image);
@@ -136,7 +136,7 @@ class TestPhysics2DMainLoop : public MainLoop {
}
}
- Image image(32, 32, 0, Image::FORMAT_LA8, pixels);
+ Ref<Image> image = memnew(Image(32, 32, 0, Image::FORMAT_LA8, pixels));
body_shape_data[Physics2DServer::SHAPE_RECTANGLE].image = vs->texture_create_from_image(image);
@@ -164,7 +164,7 @@ class TestPhysics2DMainLoop : public MainLoop {
}
}
- Image image(32, 64, 0, Image::FORMAT_LA8, pixels);
+ Ref<Image> image = memnew(Image(32, 64, 0, Image::FORMAT_LA8, pixels));
body_shape_data[Physics2DServer::SHAPE_CAPSULE].image = vs->texture_create_from_image(image);
@@ -178,7 +178,7 @@ class TestPhysics2DMainLoop : public MainLoop {
{
- Image image(convex_png);
+ Ref<Image> image = memnew(Image(convex_png));
body_shape_data[Physics2DServer::SHAPE_CONVEX_POLYGON].image = vs->texture_create_from_image(image);