Removal of Image from Variant, converted to a Resource.

This commit is contained in:
Juan Linietsky 2017-05-17 07:36:47 -03:00
parent d801ff2b3d
commit 98a3296702
110 changed files with 690 additions and 3203 deletions

View file

@ -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);
}
}

View file

@ -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

View file

@ -63,11 +63,6 @@ public:
MainLoop *test() {
Image img;
ImageLoader::load_image("as1.png", &img);
img.resize(512, 512);
return memnew(TestMainLoop);
}
}

View file

@ -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);