From e73e00d369abe54009e70498238c286708bf365a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 13 Sep 2017 09:13:23 +0200 Subject: [PATCH] Style: Apply clang-format to @reduz's changes [ci skip] --- core/os/file_access.h | 2 +- drivers/gles3/shader_compiler_gles3.cpp | 22 ++++++++++----------- editor/editor_help.cpp | 8 ++++---- editor/import/resource_importer_texture.cpp | 7 ++++--- main/main.cpp | 20 +++++++++---------- platform/windows/os_windows.cpp | 14 ++++++------- servers/visual/shader_language.h | 2 +- 7 files changed, 36 insertions(+), 39 deletions(-) diff --git a/core/os/file_access.h b/core/os/file_access.h index a3eb996c4f..8e5728f525 100644 --- a/core/os/file_access.h +++ b/core/os/file_access.h @@ -174,7 +174,7 @@ struct FileAccessRef { operator bool() const { return f != NULL; } FileAccess *f; - operator FileAccess*() { return f; } + operator FileAccess *() { return f; } FileAccessRef(FileAccess *fa) { f = fa; } ~FileAccessRef() { if (f) memdelete(f); diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 419decce29..5401c8266a 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -441,12 +441,12 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener if (!bnode->single_statement) { code += _mktab(p_level - 1) + "{\n"; } - + for (int i = 0; i < bnode->statements.size(); i++) { String scode = _dump_node_code(bnode->statements[i], p_level, r_gen_code, p_actions, p_default_actions); - if (bnode->statements[i]->type == SL::Node::TYPE_CONTROL_FLOW || bnode->single_statement ) { + if (bnode->statements[i]->type == SL::Node::TYPE_CONTROL_FLOW || bnode->single_statement) { code += scode; //use directly } else { code += _mktab(p_level) + scode + ";\n"; @@ -461,20 +461,20 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener SL::VariableDeclarationNode *vdnode = (SL::VariableDeclarationNode *)p_node; String declaration = _prestr(vdnode->precision) + _typestr(vdnode->datatype); - for(int i=0;ideclarations.size();i++) { - if (i>0) { - declaration+=","; + for (int i = 0; i < vdnode->declarations.size(); i++) { + if (i > 0) { + declaration += ","; } else { - declaration+=" "; + declaration += " "; } - declaration += _mkid(vdnode->declarations[i].name); + declaration += _mkid(vdnode->declarations[i].name); if (vdnode->declarations[i].initializer) { - declaration+="="; - declaration+=_dump_node_code(vdnode->declarations[i].initializer, p_level, r_gen_code, p_actions, p_default_actions); + declaration += "="; + declaration += _dump_node_code(vdnode->declarations[i].initializer, p_level, r_gen_code, p_actions, p_default_actions); } } - code+=declaration; + code += declaration; } break; case SL::Node::TYPE_VARIABLE: { SL::VariableNode *vnode = (SL::VariableNode *)p_node; @@ -623,7 +623,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener String left = _dump_node_code(cfnode->blocks[0], p_level, r_gen_code, p_actions, p_default_actions); String middle = _dump_node_code(cfnode->expressions[0], p_level, r_gen_code, p_actions, p_default_actions); String right = _dump_node_code(cfnode->expressions[1], p_level, r_gen_code, p_actions, p_default_actions); - code += _mktab(p_level) + "for (" +left+";"+middle+";"+right+")\n"; + code += _mktab(p_level) + "for (" + left + ";" + middle + ";" + right + ")\n"; code += _dump_node_code(cfnode->blocks[1], p_level + 1, r_gen_code, p_actions, p_default_actions); } else if (cfnode->flow_op == SL::FLOW_OP_RETURN) { diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 674ad767f0..a5baf62ea0 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -652,7 +652,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { Ref doc_font = get_font("doc", "EditorFonts"); Ref doc_title_font = get_font("doc_title", "EditorFonts"); Ref doc_code_font = get_font("doc_source", "EditorFonts"); - String link_color_text=Color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")).to_html(false); + String link_color_text = Color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")).to_html(false); h_color = Color(1, 1, 1, 1); @@ -1256,7 +1256,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->add_image(get_icon("Error", "EditorIcons")); class_desc->add_text(" "); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color")); - class_desc->append_bbcode(TTR("There is currently no description for this property. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url",CONTRIBUTE_URL).replace("$color",link_color_text)); + class_desc->append_bbcode(TTR("There is currently no description for this property. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text)); class_desc->pop(); } class_desc->pop(); @@ -1340,13 +1340,13 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); class_desc->push_font(doc_font); class_desc->push_indent(1); - if (methods[i].description.strip_edges()!=String()) { + if (methods[i].description.strip_edges() != String()) { _add_text(methods[i].description); } else { class_desc->add_image(get_icon("Error", "EditorIcons")); class_desc->add_text(" "); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color")); - class_desc->append_bbcode(TTR("There is currently no description for this method. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url",CONTRIBUTE_URL).replace("$color",link_color_text)); + class_desc->append_bbcode(TTR("There is currently no description for this method. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text)); class_desc->pop(); } diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index f29bdde634..3e3f1d1e19 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -30,10 +30,11 @@ #include "resource_importer_texture.h" #include "editor/editor_file_system.h" +#include "editor/editor_node.h" #include "io/config_file.h" #include "io/image_loader.h" #include "scene/resources/texture.h" -#include "editor/editor_node.h" + void ResourceImporterTexture::_texture_reimport_srgb(const Ref &p_tex) { singleton->mutex->lock(); @@ -412,13 +413,13 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String //must import in all formats, in order of priority (so platform choses the best supported one. IE, etc2 over etc). //Android, GLES 2.x - bool ok_on_pc=false; + bool ok_on_pc = false; if (ProjectSettings::get_singleton()->get("rendering/vram_compression/import_s3tc")) { _save_stex(image, p_save_path + ".s3tc.stex", compress_mode, lossy, Image::COMPRESS_S3TC, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal); r_platform_variants->push_back("s3tc"); - ok_on_pc=true; + ok_on_pc = true; } if (ProjectSettings::get_singleton()->get("rendering/vram_compression/import_etc2")) { diff --git a/main/main.cpp b/main/main.cpp index 58b5a6a68f..9adf319d34 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -58,9 +58,9 @@ #ifdef TOOLS_ENABLED #include "editor/doc/doc_data.h" +#include "editor/doc/doc_data_class_path.gen.h" #include "editor/editor_node.h" #include "editor/project_manager.h" -#include "editor/doc/doc_data_class_path.gen.h" #endif #include "io/file_access_network.h" @@ -75,7 +75,6 @@ #include "translation.h" #include "version.h" - static ProjectSettings *globals = NULL; static Engine *engine = NULL; static InputMap *input_map = NULL; @@ -1155,37 +1154,36 @@ bool Main::start() { DocData doc; doc.generate(doc_base); - DocData docsrc; - Map doc_data_classes; + Map doc_data_classes; Set checked_paths; print_line("Loading docs.."); - for(int i=0;i<_doc_data_class_path_count;i++) { + for (int i = 0; i < _doc_data_class_path_count; i++) { String path = doc_tool.plus_file(_doc_data_class_paths[i].path); String name = _doc_data_class_paths[i].name; - doc_data_classes[name]=path; + doc_data_classes[name] = path; if (!checked_paths.has(path)) { checked_paths.insert(path); docsrc.load_classes(path); - print_line("Loading docs from: "+path); + print_line("Loading docs from: " + path); } } String index_path = doc_tool.plus_file("doc/classes"); docsrc.load_classes(index_path); checked_paths.insert(index_path); - print_line("Loading docs from: "+index_path); + print_line("Loading docs from: " + index_path); print_line("Merging docs.."); doc.merge_from(docsrc); - for (Set::Element *E=checked_paths.front();E;E=E->next()) { - print_line("Erasing old docs at: "+E->get()); + for (Set::Element *E = checked_paths.front(); E; E = E->next()) { + print_line("Erasing old docs at: " + E->get()); DocData::erase_classes(E->get()); } print_line("Generating new docs.."); - doc.save_classes(index_path,doc_data_classes); + doc.save_classes(index_path, doc_data_classes); return false; } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index f6b5edc2c9..1052db393b 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -888,12 +888,11 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau } typedef enum _SHC_PROCESS_DPI_AWARENESS { - SHC_PROCESS_DPI_UNAWARE = 0, - SHC_PROCESS_SYSTEM_DPI_AWARE = 1, - SHC_PROCESS_PER_MONITOR_DPI_AWARE = 2 + SHC_PROCESS_DPI_UNAWARE = 0, + SHC_PROCESS_SYSTEM_DPI_AWARE = 1, + SHC_PROCESS_PER_MONITOR_DPI_AWARE = 2 } SHC_PROCESS_DPI_AWARENESS; - void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { main_loop = NULL; @@ -902,12 +901,12 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int WNDCLASSEXW wc; if (is_hidpi_allowed()) { - HMODULE Shcore = LoadLibraryW(L"Shcore.dll");; + HMODULE Shcore = LoadLibraryW(L"Shcore.dll"); if (Shcore != NULL) { - typedef HRESULT (WINAPI *SetProcessDpiAwareness_t)(SHC_PROCESS_DPI_AWARENESS); + typedef HRESULT(WINAPI * SetProcessDpiAwareness_t)(SHC_PROCESS_DPI_AWARENESS); - SetProcessDpiAwareness_t SetProcessDpiAwareness = (SetProcessDpiAwareness_t)GetProcAddress(Shcore, "SetProcessDpiAwareness"); + SetProcessDpiAwareness_t SetProcessDpiAwareness = (SetProcessDpiAwareness_t)GetProcAddress(Shcore, "SetProcessDpiAwareness"); if (SetProcessDpiAwareness) { SetProcessDpiAwareness(SHC_PROCESS_SYSTEM_DPI_AWARE); @@ -915,7 +914,6 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int } } - video_mode = p_desired; //printf("**************** desired %s, mode %s\n", p_desired.fullscreen?"true":"false", video_mode.fullscreen?"true":"false"); RECT WindowRect; diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h index 50f5cebeaa..7a7f6dd71c 100644 --- a/servers/visual/shader_language.h +++ b/servers/visual/shader_language.h @@ -371,7 +371,7 @@ public: type = TYPE_BLOCK; parent_block = NULL; parent_function = NULL; - single_statement=false; + single_statement = false; } };