You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 19:31:35 +00:00
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
This commit is contained in:
@@ -162,8 +162,9 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
|
||||
|
||||
Ref<Image> img = p_img->duplicate();
|
||||
|
||||
if (img->get_format() != Image::FORMAT_RGBA8)
|
||||
if (img->get_format() != Image::FORMAT_RGBA8) {
|
||||
img->convert(Image::FORMAT_RGBA8); //still uses RGBA to convert
|
||||
}
|
||||
|
||||
if (img->has_mipmaps()) {
|
||||
if (next_power_of_2(imgw) != imgw || next_power_of_2(imgh) != imgh) {
|
||||
@@ -201,12 +202,13 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
|
||||
|
||||
float effort = 0.0; //default, reasonable time
|
||||
|
||||
if (p_lossy_quality > 0.95)
|
||||
if (p_lossy_quality > 0.95) {
|
||||
effort = 80;
|
||||
else if (p_lossy_quality > 0.85)
|
||||
} else if (p_lossy_quality > 0.85) {
|
||||
effort = 60;
|
||||
else if (p_lossy_quality > 0.75)
|
||||
} else if (p_lossy_quality > 0.75) {
|
||||
effort = 40;
|
||||
}
|
||||
|
||||
Etc::ErrorMetric error_metric = Etc::ErrorMetric::RGBX; // NOTE: we can experiment with other error metrics
|
||||
Etc::Image::Format etc2comp_etc_format = _image_format_to_etc2comp_format(etc_format);
|
||||
|
||||
@@ -43,17 +43,20 @@ struct ETC1Header {
|
||||
};
|
||||
|
||||
RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path, Error *r_error) {
|
||||
if (r_error)
|
||||
if (r_error) {
|
||||
*r_error = ERR_CANT_OPEN;
|
||||
}
|
||||
|
||||
Error err;
|
||||
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
|
||||
if (!f)
|
||||
if (!f) {
|
||||
return RES();
|
||||
}
|
||||
|
||||
FileAccessRef fref(f);
|
||||
if (r_error)
|
||||
if (r_error) {
|
||||
*r_error = ERR_FILE_CORRUPT;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V_MSG(err != OK, RES(), "Unable to open PKM texture file '" + p_path + "'.");
|
||||
|
||||
@@ -87,8 +90,9 @@ RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path,
|
||||
Ref<ImageTexture> texture = memnew(ImageTexture);
|
||||
texture->create_from_image(img);
|
||||
|
||||
if (r_error)
|
||||
if (r_error) {
|
||||
*r_error = OK;
|
||||
}
|
||||
|
||||
f->close();
|
||||
memdelete(f);
|
||||
@@ -104,7 +108,8 @@ bool ResourceFormatPKM::handles_type(const String &p_type) const {
|
||||
}
|
||||
|
||||
String ResourceFormatPKM::get_resource_type(const String &p_path) const {
|
||||
if (p_path.get_extension().to_lower() == "pkm")
|
||||
if (p_path.get_extension().to_lower() == "pkm") {
|
||||
return "ImageTexture";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user