Add clang-format (#1086)

Co-authored-by: mwilsnd <mwilsnd@gmail.com>
This commit is contained in:
Bart Louwers
2023-05-01 16:57:37 +02:00
committed by GitHub
parent 403a12bd1b
commit 71f6da2722
1018 changed files with 27876 additions and 25862 deletions

View File

@@ -9,12 +9,14 @@
namespace mbgl {
namespace gl {
// This class provides a singleton that contains information about the configuration used for
// instantiating new headless rendering contexts.
// This class provides a singleton that contains information about the
// configuration used for instantiating new headless rendering contexts.
class GLXDisplayConfig {
private:
// Key for singleton construction.
struct Key { explicit Key() = default; };
struct Key {
explicit Key() = default;
};
public:
explicit GLXDisplayConfig(Key) {
@@ -40,7 +42,7 @@ public:
}
// We're creating a dummy pbuffer anyway that we're not using.
static int pixelFormat[] = { GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT, None };
static int pixelFormat[] = {GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT, None};
int configs = 0;
fbConfigs = glXChooseFBConfig(xDisplay, DefaultScreen(xDisplay), pixelFormat, &configs);
@@ -75,8 +77,7 @@ class GLXBackendImpl final : public HeadlessBackend::Impl {
public:
GLXBackendImpl() {
// Try to create a legacy context.
glContext = glXCreateNewContext(glxDisplay->xDisplay, glxDisplay->fbConfigs[0],
GLX_RGBA_TYPE, None, True);
glContext = glXCreateNewContext(glxDisplay->xDisplay, glxDisplay->fbConfigs[0], GLX_RGBA_TYPE, None, True);
if (glContext && !glXIsDirect(glxDisplay->xDisplay, glContext)) {
Log::Error(Event::OpenGL, "failed to create direct OpenGL Legacy context");
glXDestroyContext(glxDisplay->xDisplay, glContext);
@@ -86,11 +87,10 @@ public:
throw std::runtime_error("Error creating GL context object.");
}
// Create a dummy pbuffer. We will render to framebuffers anyway, but we need a pbuffer to
// activate the context.
int pbufferAttributes[] = { GLX_PBUFFER_WIDTH, 8, GLX_PBUFFER_HEIGHT, 8, None };
glxPbuffer =
glXCreatePbuffer(glxDisplay->xDisplay, glxDisplay->fbConfigs[0], pbufferAttributes);
// Create a dummy pbuffer. We will render to framebuffers anyway, but we
// need a pbuffer to activate the context.
int pbufferAttributes[] = {GLX_PBUFFER_WIDTH, 8, GLX_PBUFFER_HEIGHT, 8, None};
glxPbuffer = glXCreatePbuffer(glxDisplay->xDisplay, glxDisplay->fbConfigs[0], pbufferAttributes);
}
~GLXBackendImpl() final {