From f35f11106d0c1cf8f19ad94bed3e206859a4e1e6 Mon Sep 17 00:00:00 2001 From: Jiacheng Lu Date: Fri, 19 Jul 2019 09:18:55 -0600 Subject: [PATCH] Add script to apply clang-format on all sources 1. python script wrapper to call clang-format over the whole code base 2. Add clang-format rule `IncludeBlocks: Preserve` to tell clang-format do not merge include blocks 3. Fix existed clang-format issue in code base Bug: angleproject:3532 Change-Id: I289292dc62c2784ff21688065c87c3f3f5538f17 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1709720 Reviewed-by: Jamie Madill Commit-Queue: Jamie Madill --- .clang-format | 5 + scripts/apply_clang_format_on_all_sources.py | 51 +++++ .../feature_support_util_unittest.cpp | 10 +- src/libANGLE/Debug.h | 2 +- src/libANGLE/ProgramLinkedResources.cpp | 8 +- src/libANGLE/renderer/SurfaceImpl.h | 2 +- src/libANGLE/renderer/d3d/DynamicHLSL.h | 2 +- .../renderer/d3d/DynamicImage2DHLSL.cpp | 4 +- src/libANGLE/renderer/d3d/RendererD3D.h | 4 +- src/libANGLE/renderer/vulkan/ProgramVk.cpp | 2 +- src/tests/perf_tests/glmark2Benchmark.cpp | 2 +- .../GPUTestExpectationsParser.cpp | 6 +- src/tests/test_utils/VulkanExternalHelper.h | 2 +- util/Event.h | 44 ++-- util/Matrix.cpp | 2 +- util/com_utils.h | 5 +- util/geometry_utils.cpp | 16 +- util/keyboard.h | 204 +++++++++--------- util/mouse.h | 2 +- util/posix/Posix_system_utils.cpp | 6 +- util/random_utils.cpp | 8 +- 21 files changed, 216 insertions(+), 171 deletions(-) create mode 100755 scripts/apply_clang_format_on_all_sources.py diff --git a/.clang-format b/.clang-format index e5ff7cf48..88cc9aa87 100644 --- a/.clang-format +++ b/.clang-format @@ -15,6 +15,8 @@ ColumnLimit: 100 # Always break before braces BreakBeforeBraces: Custom BraceWrapping: +# TODO(lujc) wait for clang-format-9 support in Chromium tools +# AfterCaseLabel: true AfterClass: true AfterControlStatement: true AfterEnum: true @@ -53,3 +55,6 @@ KeepEmptyLinesAtTheStartOfBlocks: true # Indent nested PP directives. IndentPPDirectives: AfterHash + +# Include blocks style +IncludeBlocks: Preserve diff --git a/scripts/apply_clang_format_on_all_sources.py b/scripts/apply_clang_format_on_all_sources.py new file mode 100755 index 000000000..779ef91e8 --- /dev/null +++ b/scripts/apply_clang_format_on_all_sources.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +# Copyright 2019 The ANGLE Project Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# apply_clang_format_on_all_sources.py: +# Script to apply clang-format recursively on directory, +# example usage: +# ./scripts/apply_clang_format_on_all_sources.py src + +from __future__ import print_function + +import os +import sys +import platform +import subprocess + +# inplace change and use style from .clang-format +CLANG_FORMAT_ARGS = ['-i', '-style=file'] + + +def main(directory): + system = platform.system() + + clang_format_exe = 'clang-format' + if system == 'Windows': + clang_format_exe += '.bat' + + partial_cmd = [clang_format_exe] + CLANG_FORMAT_ARGS + + for subdir, _, files in os.walk(directory): + if 'third_party' in subdir: + continue + + for f in files: + if f.endswith(('.c', '.h', '.cpp', '.hpp')): + f_abspath = os.path.join(subdir, f) + print("Applying clang-format on ", f_abspath) + subprocess.check_call(partial_cmd + [f_abspath]) + + +if __name__ == '__main__': + if len(sys.argv) > 2: + print('Too mang args', file=sys.stderr) + + elif len(sys.argv) == 2: + main(os.path.join(os.getcwd(), sys.argv[1])) + + else: + main(os.getcwd()) diff --git a/src/feature_support_util/feature_support_util_unittest.cpp b/src/feature_support_util/feature_support_util_unittest.cpp index 1d6784f64..77c57582c 100644 --- a/src/feature_support_util/feature_support_util_unittest.cpp +++ b/src/feature_support_util/feature_support_util_unittest.cpp @@ -65,7 +65,7 @@ TEST_F(FeatureSupportUtilTest, APIVersion) // Test the ANGLEAddDeviceInfoToSystemInfo function TEST_F(FeatureSupportUtilTest, SystemInfo) { - SystemInfo systemInfo = mSystemInfo; + SystemInfo systemInfo = mSystemInfo; systemInfo.machineManufacturer = "BAD"; systemInfo.machineModelName = "BAD"; @@ -87,8 +87,8 @@ TEST_F(FeatureSupportUtilTest, ParseRules) ] } )rulefile"; - RulesHandle rulesHandle = nullptr; - int rulesVersion = 0; + RulesHandle rulesHandle = nullptr; + int rulesVersion = 0; EXPECT_TRUE(ANGLEAndroidParseRulesString(kRulesFileContents, &rulesHandle, &rulesVersion)); EXPECT_NE(nullptr, rulesHandle); ANGLEFreeRulesHandle(rulesHandle); @@ -140,8 +140,8 @@ TEST_F(FeatureSupportUtilTest, TestRuleProcessing) ] } )rulefile"; - RulesHandle rulesHandle = nullptr; - int rulesVersion = 0; + RulesHandle rulesHandle = nullptr; + int rulesVersion = 0; EXPECT_TRUE(ANGLEAndroidParseRulesString(kRulesFileContents, &rulesHandle, &rulesVersion)); EXPECT_NE(nullptr, rulesHandle); diff --git a/src/libANGLE/Debug.h b/src/libANGLE/Debug.h index d3b4988a6..2c39e8c79 100644 --- a/src/libANGLE/Debug.h +++ b/src/libANGLE/Debug.h @@ -27,7 +27,7 @@ class LabeledObject public: virtual ~LabeledObject() {} virtual void setLabel(const Context *context, const std::string &label) = 0; - virtual const std::string &getLabel() const = 0; + virtual const std::string &getLabel() const = 0; }; class Debug : angle::NonCopyable diff --git a/src/libANGLE/ProgramLinkedResources.cpp b/src/libANGLE/ProgramLinkedResources.cpp index fa30ffdd2..cd2086dc1 100644 --- a/src/libANGLE/ProgramLinkedResources.cpp +++ b/src/libANGLE/ProgramLinkedResources.cpp @@ -407,10 +407,10 @@ class FlattenUniformVisitor : public sh::VariableNameVisitor const std::string &name, const std::string &mappedName) override { - bool isSampler = IsSamplerType(variable.type); - bool isImage = IsImageType(variable.type); - bool isAtomicCounter = IsAtomicCounterType(variable.type); - std::vector *uniformList = mUniforms; + bool isSampler = IsSamplerType(variable.type); + bool isImage = IsImageType(variable.type); + bool isAtomicCounter = IsAtomicCounterType(variable.type); + std::vector *uniformList = mUniforms; if (isSampler) { uniformList = mSamplerUniforms; diff --git a/src/libANGLE/renderer/SurfaceImpl.h b/src/libANGLE/renderer/SurfaceImpl.h index e223c3139..e0121cdaf 100644 --- a/src/libANGLE/renderer/SurfaceImpl.h +++ b/src/libANGLE/renderer/SurfaceImpl.h @@ -55,7 +55,7 @@ class SurfaceImpl : public FramebufferAttachmentObjectImpl const gl::FramebufferState &state) = 0; virtual egl::Error makeCurrent(const gl::Context *context); virtual egl::Error unMakeCurrent(const gl::Context *context); - virtual egl::Error swap(const gl::Context *context) = 0; + virtual egl::Error swap(const gl::Context *context) = 0; virtual egl::Error swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects); virtual egl::Error postSubBuffer(const gl::Context *context, EGLint x, diff --git a/src/libANGLE/renderer/d3d/DynamicHLSL.h b/src/libANGLE/renderer/d3d/DynamicHLSL.h index 11bc11d72..bbf379efe 100644 --- a/src/libANGLE/renderer/d3d/DynamicHLSL.h +++ b/src/libANGLE/renderer/d3d/DynamicHLSL.h @@ -80,7 +80,7 @@ struct PixelShaderOutputVariable std::string name; std::string source; size_t outputLocation = 0; - size_t outputIndex = 0; + size_t outputIndex = 0; }; struct BuiltinVarying final : private angle::NonCopyable diff --git a/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.cpp b/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.cpp index ff67cc526..702754932 100644 --- a/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.cpp +++ b/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.cpp @@ -825,8 +825,8 @@ void OutputHLSLImage2DUniformGroup(ProgramD3D &programD3D, out << "};\n"; } - gl::Shader *shaderGL = programData.getAttachedShader(shaderType); - const ShaderD3D *shaderD3D = GetImplAs(shaderGL); + gl::Shader *shaderGL = programData.getAttachedShader(shaderType); + const ShaderD3D *shaderD3D = GetImplAs(shaderGL); const bool getDimensionsIgnoresBaseLevel = programD3D.usesGetDimensionsIgnoresBaseLevel(); if (shaderD3D->useImage2DFunction(Image2DHLSLGroupFunctionName(textureGroup, IMAGE2DSIZE))) diff --git a/src/libANGLE/renderer/d3d/RendererD3D.h b/src/libANGLE/renderer/d3d/RendererD3D.h index 0c54e0b82..68cedaa60 100644 --- a/src/libANGLE/renderer/d3d/RendererD3D.h +++ b/src/libANGLE/renderer/d3d/RendererD3D.h @@ -275,7 +275,7 @@ class RendererD3D : public BufferFactoryD3D virtual UniformStorageD3D *createUniformStorage(size_t storageSize) = 0; // Image operations - virtual ImageD3D *createImage() = 0; + virtual ImageD3D *createImage() = 0; virtual ExternalImageSiblingImpl *createExternalImageSibling( const gl::Context *context, EGLenum target, @@ -386,7 +386,7 @@ class RendererD3D : public BufferFactoryD3D // Necessary hack for default framebuffers in D3D. virtual FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) = 0; - virtual gl::Version getMaxSupportedESVersion() const = 0; + virtual gl::Version getMaxSupportedESVersion() const = 0; virtual gl::Version getMaxConformantESVersion() const = 0; angle::Result initRenderTarget(const gl::Context *context, RenderTargetD3D *renderTarget); diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.cpp b/src/libANGLE/renderer/vulkan/ProgramVk.cpp index 6c72eeb45..3462ae31f 100644 --- a/src/libANGLE/renderer/vulkan/ProgramVk.cpp +++ b/src/libANGLE/renderer/vulkan/ProgramVk.cpp @@ -1032,7 +1032,7 @@ void ProgramVk::updateBuffersDescriptorSet(ContextVk *contextVk, gl::StorageBuffersArray descriptorBufferInfo; gl::StorageBuffersArray writeDescriptorInfo; - uint32_t writeCount = 0; + uint32_t writeCount = 0; // The binding is incremented every time arrayElement 0 is encountered, which means there will // be an increment right at the start. Start from -1 to get 0 as the first binding. int32_t currentBinding = -1; diff --git a/src/tests/perf_tests/glmark2Benchmark.cpp b/src/tests/perf_tests/glmark2Benchmark.cpp index 7be924ffe..9e87b40bc 100644 --- a/src/tests/perf_tests/glmark2Benchmark.cpp +++ b/src/tests/perf_tests/glmark2Benchmark.cpp @@ -121,7 +121,7 @@ class GLMark2Benchmark : public testing::TestWithParam(GetParam())]; const char *benchmark = benchmarkInfo.glmark2Config; const char *benchmarkName = benchmarkInfo.name; - bool completeRun = benchmark == nullptr || benchmark[0] == '\0'; + bool completeRun = benchmark == nullptr || benchmark[0] == '\0'; Optional cwd = GetCWD(); diff --git a/src/tests/test_expectations/GPUTestExpectationsParser.cpp b/src/tests/test_expectations/GPUTestExpectationsParser.cpp index 434196d39..0c94638a9 100644 --- a/src/tests/test_expectations/GPUTestExpectationsParser.cpp +++ b/src/tests/test_expectations/GPUTestExpectationsParser.cpp @@ -350,9 +350,9 @@ bool GPUTestExpectationsParser::parseLine(const GPUTestConfig &config, SplitString(lineData, kWhitespaceASCII, KEEP_WHITESPACE, SPLIT_WANT_NONEMPTY); int32_t stage = kLineParserBegin; GPUTestExpectationEntry entry; - entry.lineNumber = lineNumber; - entry.used = false; - bool skipLine = false; + entry.lineNumber = lineNumber; + entry.used = false; + bool skipLine = false; for (size_t i = 0; i < tokens.size() && !skipLine; ++i) { Token token = ParseToken(tokens[i]); diff --git a/src/tests/test_utils/VulkanExternalHelper.h b/src/tests/test_utils/VulkanExternalHelper.h index e1939e8bb..0b70d4daa 100644 --- a/src/tests/test_utils/VulkanExternalHelper.h +++ b/src/tests/test_utils/VulkanExternalHelper.h @@ -54,7 +54,7 @@ class VulkanExternalHelper bool mHasExternalSemaphoreFd = false; PFN_vkGetPhysicalDeviceImageFormatProperties2 vkGetPhysicalDeviceImageFormatProperties2 = nullptr; - PFN_vkGetMemoryFdKHR vkGetMemoryFdKHR = nullptr; + PFN_vkGetMemoryFdKHR vkGetMemoryFdKHR = nullptr; PFN_vkGetSemaphoreFdKHR vkGetSemaphoreFdKHR = nullptr; PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR vkGetPhysicalDeviceExternalSemaphorePropertiesKHR = nullptr; diff --git a/util/Event.h b/util/Event.h index 7dd9cb367..5fb17e6d2 100644 --- a/util/Event.h +++ b/util/Event.h @@ -54,34 +54,34 @@ class Event enum EventType { - EVENT_CLOSED, // The window requested to be closed - EVENT_MOVED, // The window has moved - EVENT_RESIZED, // The window was resized - EVENT_LOST_FOCUS, // The window lost the focus - EVENT_GAINED_FOCUS, // The window gained the focus - EVENT_TEXT_ENTERED, // A character was entered - EVENT_KEY_PRESSED, // A key was pressed - EVENT_KEY_RELEASED, // A key was released - EVENT_MOUSE_WHEEL_MOVED, // The mouse wheel was scrolled - EVENT_MOUSE_BUTTON_PRESSED, // A mouse button was pressed - EVENT_MOUSE_BUTTON_RELEASED, // A mouse button was released - EVENT_MOUSE_MOVED, // The mouse cursor moved - EVENT_MOUSE_ENTERED, // The mouse cursor entered the area of the window - EVENT_MOUSE_LEFT, // The mouse cursor left the area of the window - EVENT_TEST, // Event for testing purposes + EVENT_CLOSED, // The window requested to be closed + EVENT_MOVED, // The window has moved + EVENT_RESIZED, // The window was resized + EVENT_LOST_FOCUS, // The window lost the focus + EVENT_GAINED_FOCUS, // The window gained the focus + EVENT_TEXT_ENTERED, // A character was entered + EVENT_KEY_PRESSED, // A key was pressed + EVENT_KEY_RELEASED, // A key was released + EVENT_MOUSE_WHEEL_MOVED, // The mouse wheel was scrolled + EVENT_MOUSE_BUTTON_PRESSED, // A mouse button was pressed + EVENT_MOUSE_BUTTON_RELEASED, // A mouse button was released + EVENT_MOUSE_MOVED, // The mouse cursor moved + EVENT_MOUSE_ENTERED, // The mouse cursor entered the area of the window + EVENT_MOUSE_LEFT, // The mouse cursor left the area of the window + EVENT_TEST, // Event for testing purposes }; EventType Type; union { - MoveEvent Move; // Move event parameters - SizeEvent Size; // Size event parameters - KeyEvent Key; // Key event parameters - MouseMoveEvent MouseMove; // Mouse move event parameters - MouseButtonEvent MouseButton; // Mouse button event parameters - MouseWheelEvent MouseWheel; // Mouse wheel event parameters + MoveEvent Move; // Move event parameters + SizeEvent Size; // Size event parameters + KeyEvent Key; // Key event parameters + MouseMoveEvent MouseMove; // Mouse move event parameters + MouseButtonEvent MouseButton; // Mouse button event parameters + MouseWheelEvent MouseWheel; // Mouse wheel event parameters }; }; -#endif // SAMPLE_UTIL_EVENT_H +#endif // SAMPLE_UTIL_EVENT_H diff --git a/util/Matrix.cpp b/util/Matrix.cpp index 34af4341c..06320b665 100644 --- a/util/Matrix.cpp +++ b/util/Matrix.cpp @@ -116,7 +116,7 @@ Matrix4 Matrix4::frustum(float l, float r, float b, float t, float n, float f) Matrix4 Matrix4::perspective(float fovY, float aspectRatio, float nearZ, float farZ) { const float frustumHeight = tanf(static_cast(fovY / 360.0f * M_PI)) * nearZ; - const float frustumWidth = frustumHeight * aspectRatio; + const float frustumWidth = frustumHeight * aspectRatio; return frustum(-frustumWidth, frustumWidth, -frustumHeight, frustumHeight, nearZ, farZ); } diff --git a/util/com_utils.h b/util/com_utils.h index 225783c55..da9e630f8 100644 --- a/util/com_utils.h +++ b/util/com_utils.h @@ -13,7 +13,8 @@ template inline outType *DynamicCastComObject(IUnknown *object) { outType *outObject = nullptr; - HRESULT result = object->QueryInterface(__uuidof(outType), reinterpret_cast(&outObject)); + HRESULT result = + object->QueryInterface(__uuidof(outType), reinterpret_cast(&outObject)); if (SUCCEEDED(result)) { return outObject; @@ -25,4 +26,4 @@ inline outType *DynamicCastComObject(IUnknown *object) } } -#endif // UTIL_COM_UTILS_H +#endif // UTIL_COM_UTILS_H diff --git a/util/geometry_utils.cpp b/util/geometry_utils.cpp index 2f7593cbc..4395ae323 100644 --- a/util/geometry_utils.cpp +++ b/util/geometry_utils.cpp @@ -14,21 +14,13 @@ using namespace angle; -SphereGeometry::SphereGeometry() -{ -} +SphereGeometry::SphereGeometry() {} -SphereGeometry::~SphereGeometry() -{ -} +SphereGeometry::~SphereGeometry() {} -CubeGeometry::CubeGeometry() -{ -} +CubeGeometry::CubeGeometry() {} -CubeGeometry::~CubeGeometry() -{ -} +CubeGeometry::~CubeGeometry() {} void CreateSphereGeometry(size_t sliceCount, float radius, SphereGeometry *result) { diff --git a/util/keyboard.h b/util/keyboard.h index 2718dd5ab..99771049f 100644 --- a/util/keyboard.h +++ b/util/keyboard.h @@ -10,108 +10,108 @@ enum Key { KEY_UNKNOWN, - KEY_A, // The A key - KEY_B, // The B key - KEY_C, // The C key - KEY_D, // The D key - KEY_E, // The E key - KEY_F, // The F key - KEY_G, // The G key - KEY_H, // The H key - KEY_I, // The I key - KEY_J, // The J key - KEY_K, // The K key - KEY_L, // The L key - KEY_M, // The M key - KEY_N, // The N key - KEY_O, // The O key - KEY_P, // The P key - KEY_Q, // The Q key - KEY_R, // The R key - KEY_S, // The S key - KEY_T, // The T key - KEY_U, // The U key - KEY_V, // The V key - KEY_W, // The W key - KEY_X, // The X key - KEY_Y, // The Y key - KEY_Z, // The Z key - KEY_NUM0, // The 0 key - KEY_NUM1, // The 1 key - KEY_NUM2, // The 2 key - KEY_NUM3, // The 3 key - KEY_NUM4, // The 4 key - KEY_NUM5, // The 5 key - KEY_NUM6, // The 6 key - KEY_NUM7, // The 7 key - KEY_NUM8, // The 8 key - KEY_NUM9, // The 9 key - KEY_ESCAPE, // The escape key - KEY_LCONTROL, // The left control key - KEY_LSHIFT, // The left shift key - KEY_LALT, // The left alt key - KEY_LSYSTEM, // The left OS specific key: Window (Windows and Linux), Apple (MacOS X), ... - KEY_RCONTROL, // The right control key - KEY_RSHIFT, // The right shift key - KEY_RALT, // The right alt key - KEY_RSYSTEM, // The right OS specific key: Window (Windows and Linux), Apple (MacOS X), ... - KEY_MENU, // The menu key - KEY_LBRACKET, // The [ key - KEY_RBRACKET, // The ] key - KEY_SEMICOLON, // The ; key - KEY_COMMA, // The , key - KEY_PERIOD, // The . key - KEY_QUOTE, // The ' key - KEY_SLASH, // The / key - KEY_BACKSLASH, // The \ key - KEY_TILDE, // The ~ key - KEY_EQUAL, // The = key - KEY_DASH, // The - key - KEY_SPACE, // The space key - KEY_RETURN, // The return key - KEY_BACK, // The backspace key - KEY_TAB, // The tabulation key - KEY_PAGEUP, // The page up key - KEY_PAGEDOWN, // The page down key - KEY_END, // The end key - KEY_HOME, // The home key - KEY_INSERT, // The insert key - KEY_DELETE, // The delete key - KEY_ADD, // + - KEY_SUBTRACT, // - - KEY_MULTIPLY, // * - KEY_DIVIDE, // / - KEY_LEFT, // Left arrow - KEY_RIGHT, // Right arrow - KEY_UP, // Up arrow - KEY_DOWN, // Down arrow - KEY_NUMPAD0, // The numpad 0 key - KEY_NUMPAD1, // The numpad 1 key - KEY_NUMPAD2, // The numpad 2 key - KEY_NUMPAD3, // The numpad 3 key - KEY_NUMPAD4, // The numpad 4 key - KEY_NUMPAD5, // The numpad 5 key - KEY_NUMPAD6, // The numpad 6 key - KEY_NUMPAD7, // The numpad 7 key - KEY_NUMPAD8, // The numpad 8 key - KEY_NUMPAD9, // The numpad 9 key - KEY_F1, // The F1 key - KEY_F2, // The F2 key - KEY_F3, // The F3 key - KEY_F4, // The F4 key - KEY_F5, // The F5 key - KEY_F6, // The F6 key - KEY_F7, // The F7 key - KEY_F8, // The F8 key - KEY_F9, // The F8 key - KEY_F10, // The F10 key - KEY_F11, // The F11 key - KEY_F12, // The F12 key - KEY_F13, // The F13 key - KEY_F14, // The F14 key - KEY_F15, // The F15 key - KEY_PAUSE, // The pause key + KEY_A, // The A key + KEY_B, // The B key + KEY_C, // The C key + KEY_D, // The D key + KEY_E, // The E key + KEY_F, // The F key + KEY_G, // The G key + KEY_H, // The H key + KEY_I, // The I key + KEY_J, // The J key + KEY_K, // The K key + KEY_L, // The L key + KEY_M, // The M key + KEY_N, // The N key + KEY_O, // The O key + KEY_P, // The P key + KEY_Q, // The Q key + KEY_R, // The R key + KEY_S, // The S key + KEY_T, // The T key + KEY_U, // The U key + KEY_V, // The V key + KEY_W, // The W key + KEY_X, // The X key + KEY_Y, // The Y key + KEY_Z, // The Z key + KEY_NUM0, // The 0 key + KEY_NUM1, // The 1 key + KEY_NUM2, // The 2 key + KEY_NUM3, // The 3 key + KEY_NUM4, // The 4 key + KEY_NUM5, // The 5 key + KEY_NUM6, // The 6 key + KEY_NUM7, // The 7 key + KEY_NUM8, // The 8 key + KEY_NUM9, // The 9 key + KEY_ESCAPE, // The escape key + KEY_LCONTROL, // The left control key + KEY_LSHIFT, // The left shift key + KEY_LALT, // The left alt key + KEY_LSYSTEM, // The left OS specific key: Window (Windows and Linux), Apple (MacOS X), ... + KEY_RCONTROL, // The right control key + KEY_RSHIFT, // The right shift key + KEY_RALT, // The right alt key + KEY_RSYSTEM, // The right OS specific key: Window (Windows and Linux), Apple (MacOS X), ... + KEY_MENU, // The menu key + KEY_LBRACKET, // The [ key + KEY_RBRACKET, // The ] key + KEY_SEMICOLON, // The ; key + KEY_COMMA, // The , key + KEY_PERIOD, // The . key + KEY_QUOTE, // The ' key + KEY_SLASH, // The / key + KEY_BACKSLASH, // The \ key + KEY_TILDE, // The ~ key + KEY_EQUAL, // The = key + KEY_DASH, // The - key + KEY_SPACE, // The space key + KEY_RETURN, // The return key + KEY_BACK, // The backspace key + KEY_TAB, // The tabulation key + KEY_PAGEUP, // The page up key + KEY_PAGEDOWN, // The page down key + KEY_END, // The end key + KEY_HOME, // The home key + KEY_INSERT, // The insert key + KEY_DELETE, // The delete key + KEY_ADD, // + + KEY_SUBTRACT, // - + KEY_MULTIPLY, // * + KEY_DIVIDE, // / + KEY_LEFT, // Left arrow + KEY_RIGHT, // Right arrow + KEY_UP, // Up arrow + KEY_DOWN, // Down arrow + KEY_NUMPAD0, // The numpad 0 key + KEY_NUMPAD1, // The numpad 1 key + KEY_NUMPAD2, // The numpad 2 key + KEY_NUMPAD3, // The numpad 3 key + KEY_NUMPAD4, // The numpad 4 key + KEY_NUMPAD5, // The numpad 5 key + KEY_NUMPAD6, // The numpad 6 key + KEY_NUMPAD7, // The numpad 7 key + KEY_NUMPAD8, // The numpad 8 key + KEY_NUMPAD9, // The numpad 9 key + KEY_F1, // The F1 key + KEY_F2, // The F2 key + KEY_F3, // The F3 key + KEY_F4, // The F4 key + KEY_F5, // The F5 key + KEY_F6, // The F6 key + KEY_F7, // The F7 key + KEY_F8, // The F8 key + KEY_F9, // The F8 key + KEY_F10, // The F10 key + KEY_F11, // The F11 key + KEY_F12, // The F12 key + KEY_F13, // The F13 key + KEY_F14, // The F14 key + KEY_F15, // The F15 key + KEY_PAUSE, // The pause key KEY_COUNT, }; -#endif // SAMPLE_UTIL_KEYBOARD_H +#endif // SAMPLE_UTIL_KEYBOARD_H diff --git a/util/mouse.h b/util/mouse.h index d51b96d74..dcddf4682 100644 --- a/util/mouse.h +++ b/util/mouse.h @@ -18,4 +18,4 @@ enum MouseButton MOUSEBUTTON_COUNT, }; -#endif // SAMPLE_UTIL_MOUSE_H +#endif // SAMPLE_UTIL_MOUSE_H diff --git a/util/posix/Posix_system_utils.cpp b/util/posix/Posix_system_utils.cpp index 92100880f..372608bd1 100644 --- a/util/posix/Posix_system_utils.cpp +++ b/util/posix/Posix_system_utils.cpp @@ -70,7 +70,7 @@ bool StabilizeCPUForBenchmarking() "default priority"); success = false; } -#if ANGLE_PLATFORM_LINUX +# if ANGLE_PLATFORM_LINUX cpu_set_t affinity; CPU_SET(0, &affinity); errno = 0; @@ -81,9 +81,9 @@ bool StabilizeCPUForBenchmarking() "default affinity"); success = false; } -#else +# else // TODO(jmadill): Implement for non-linux. http://anglebug.com/2923 -#endif +# endif return success; #else // defined(ANGLE_PLATFORM_FUCHSIA) diff --git a/util/random_utils.cpp b/util/random_utils.cpp index d64fa5b15..e3fb25d70 100644 --- a/util/random_utils.cpp +++ b/util/random_utils.cpp @@ -24,13 +24,9 @@ RNG::RNG() } // Seed from fixed number. -RNG::RNG(unsigned int seed) : mGenerator(seed) -{ -} +RNG::RNG(unsigned int seed) : mGenerator(seed) {} -RNG::~RNG() -{ -} +RNG::~RNG() {} void RNG::reseed(unsigned int newSeed) {