mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user