summaryrefslogtreecommitdiff
path: root/core/io/image_loader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/io/image_loader.cpp')
-rw-r--r--core/io/image_loader.cpp16
1 files changed, 0 insertions, 16 deletions
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index 01e6bb5618..06e3cc029d 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -33,11 +33,9 @@
#include "core/print_string.h"
bool ImageFormatLoader::recognize(const String &p_extension) const {
-
List<String> extensions;
get_recognized_extensions(&extensions);
for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
-
if (E->get().nocasecmp_to(p_extension) == 0)
return true;
}
@@ -61,7 +59,6 @@ Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_c
String extension = p_file.get_extension();
for (int i = 0; i < loader.size(); i++) {
-
if (!loader[i]->recognize(extension))
continue;
Error err = loader[i]->load_image(p_image, f, p_force_linear, p_scale);
@@ -70,7 +67,6 @@ Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_c
}
if (err != ERR_FILE_UNRECOGNIZED) {
-
if (!p_custom)
memdelete(f);
@@ -85,17 +81,13 @@ Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_c
}
void ImageLoader::get_recognized_extensions(List<String> *p_extensions) {
-
for (int i = 0; i < loader.size(); i++) {
-
loader[i]->get_recognized_extensions(p_extensions);
}
}
ImageFormatLoader *ImageLoader::recognize(const String &p_extension) {
-
for (int i = 0; i < loader.size(); i++) {
-
if (loader[i]->recognize(p_extension))
return loader[i];
}
@@ -106,22 +98,18 @@ ImageFormatLoader *ImageLoader::recognize(const String &p_extension) {
Vector<ImageFormatLoader *> ImageLoader::loader;
void ImageLoader::add_image_format_loader(ImageFormatLoader *p_loader) {
-
loader.push_back(p_loader);
}
void ImageLoader::remove_image_format_loader(ImageFormatLoader *p_loader) {
-
loader.erase(p_loader);
}
const Vector<ImageFormatLoader *> &ImageLoader::get_image_format_loaders() {
-
return loader;
}
void ImageLoader::cleanup() {
-
while (loader.size()) {
remove_image_format_loader(loader[0]);
}
@@ -130,7 +118,6 @@ void ImageLoader::cleanup() {
/////////////////
RES ResourceFormatLoaderImage::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
-
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
if (!f) {
if (r_error) {
@@ -192,16 +179,13 @@ RES ResourceFormatLoaderImage::load(const String &p_path, const String &p_origin
}
void ResourceFormatLoaderImage::get_recognized_extensions(List<String> *p_extensions) const {
-
p_extensions->push_back("image");
}
bool ResourceFormatLoaderImage::handles_type(const String &p_type) const {
-
return p_type == "Image";
}
String ResourceFormatLoaderImage::get_resource_type(const String &p_path) const {
-
return p_path.get_extension().to_lower() == "image" ? "Image" : String();
}