mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:30:05 +00:00
Another round of clang-tidy fixes
This commit is contained in:
parent
8e9db6a2fe
commit
17af5e27ac
5 changed files with 62 additions and 50 deletions
|
|
@ -10,13 +10,7 @@
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <mbgl/util/constants.hpp>
|
#include <mbgl/util/constants.hpp>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx::qt::gl::draw
|
||||||
{
|
|
||||||
namespace qt
|
|
||||||
{
|
|
||||||
namespace gl
|
|
||||||
{
|
|
||||||
namespace draw
|
|
||||||
{
|
{
|
||||||
|
|
||||||
static const std::string logPrefix_ = "scwx::qt::gl::draw::placefile_text";
|
static const std::string logPrefix_ = "scwx::qt::gl::draw::placefile_text";
|
||||||
|
|
@ -25,12 +19,16 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||||
class PlacefileText::Impl
|
class PlacefileText::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl(const std::string& placefileName) :
|
explicit Impl(std::string placefileName) :
|
||||||
placefileName_ {placefileName}
|
placefileName_ {std::move(placefileName)}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
~Impl() = default;
|
||||||
|
|
||||||
~Impl() {}
|
Impl(const Impl&) = delete;
|
||||||
|
Impl& operator=(const Impl&) = delete;
|
||||||
|
Impl(const Impl&&) = delete;
|
||||||
|
Impl& operator=(const Impl&&) = delete;
|
||||||
|
|
||||||
void RenderTextDrawItem(
|
void RenderTextDrawItem(
|
||||||
const QMapLibre::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
|
|
@ -306,7 +304,4 @@ void PlacefileText::FinishText()
|
||||||
p->newFonts_.clear();
|
p->newFonts_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace draw
|
} // namespace scwx::qt::gl::draw
|
||||||
} // namespace gl
|
|
||||||
} // namespace qt
|
|
||||||
} // namespace scwx
|
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,7 @@
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx::qt::gl::draw
|
||||||
{
|
|
||||||
namespace qt
|
|
||||||
{
|
|
||||||
namespace gl
|
|
||||||
{
|
|
||||||
namespace draw
|
|
||||||
{
|
{
|
||||||
|
|
||||||
static const std::string logPrefix_ = "scwx::qt::gl::draw::rectangle";
|
static const std::string logPrefix_ = "scwx::qt::gl::draw::rectangle";
|
||||||
|
|
@ -27,7 +21,7 @@ class Rectangle::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl(std::shared_ptr<GlContext> context) :
|
explicit Impl(std::shared_ptr<GlContext> context) :
|
||||||
context_ {context},
|
context_ {std::move(context)},
|
||||||
dirty_ {false},
|
dirty_ {false},
|
||||||
visible_ {true},
|
visible_ {true},
|
||||||
x_ {0.0f},
|
x_ {0.0f},
|
||||||
|
|
@ -44,8 +38,12 @@ public:
|
||||||
vbo_ {GL_INVALID_INDEX}
|
vbo_ {GL_INVALID_INDEX}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
~Impl() = default;
|
||||||
|
|
||||||
~Impl() {}
|
Impl(const Impl&) = delete;
|
||||||
|
Impl& operator=(const Impl&) = delete;
|
||||||
|
Impl(const Impl&&) = delete;
|
||||||
|
Impl& operator=(const Impl&&) = delete;
|
||||||
|
|
||||||
std::shared_ptr<GlContext> context_;
|
std::shared_ptr<GlContext> context_;
|
||||||
|
|
||||||
|
|
@ -101,6 +99,7 @@ void Rectangle::Initialize()
|
||||||
glBufferData(
|
glBufferData(
|
||||||
GL_ARRAY_BUFFER, sizeof(float) * BUFFER_LENGTH, nullptr, GL_DYNAMIC_DRAW);
|
GL_ARRAY_BUFFER, sizeof(float) * BUFFER_LENGTH, nullptr, GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
// NOLINTBEGIN(modernize-use-nullptr)
|
||||||
// NOLINTBEGIN(performance-no-int-to-ptr)
|
// NOLINTBEGIN(performance-no-int-to-ptr)
|
||||||
|
|
||||||
glVertexAttribPointer(0,
|
glVertexAttribPointer(0,
|
||||||
|
|
@ -120,6 +119,7 @@ void Rectangle::Initialize()
|
||||||
glEnableVertexAttribArray(1);
|
glEnableVertexAttribArray(1);
|
||||||
|
|
||||||
// NOLINTEND(performance-no-int-to-ptr)
|
// NOLINTEND(performance-no-int-to-ptr)
|
||||||
|
// NOLINTEND(modernize-use-nullptr)
|
||||||
|
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
@ -296,7 +296,4 @@ void Rectangle::Impl::Update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace draw
|
} // namespace scwx::qt::gl::draw
|
||||||
} // namespace gl
|
|
||||||
} // namespace qt
|
|
||||||
} // namespace scwx
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,7 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx::qt::gl
|
||||||
{
|
|
||||||
namespace qt
|
|
||||||
{
|
|
||||||
namespace gl
|
|
||||||
{
|
{
|
||||||
|
|
||||||
static const std::string logPrefix_ = "scwx::qt::gl::shader_program";
|
static const std::string logPrefix_ = "scwx::qt::gl::shader_program";
|
||||||
|
|
@ -24,11 +20,7 @@ static const std::unordered_map<GLenum, std::string> kShaderNames_ {
|
||||||
class ShaderProgram::Impl
|
class ShaderProgram::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl() : id_ {GL_INVALID_INDEX}
|
explicit Impl() : id_ {glCreateProgram()} {}
|
||||||
{
|
|
||||||
// Create shader program
|
|
||||||
id_ = glCreateProgram();
|
|
||||||
}
|
|
||||||
|
|
||||||
~Impl()
|
~Impl()
|
||||||
{
|
{
|
||||||
|
|
@ -36,6 +28,11 @@ public:
|
||||||
glDeleteProgram(id_);
|
glDeleteProgram(id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Impl(const Impl&) = delete;
|
||||||
|
Impl& operator=(const Impl&) = delete;
|
||||||
|
Impl(const Impl&&) = delete;
|
||||||
|
Impl& operator=(const Impl&&) = delete;
|
||||||
|
|
||||||
static std::string ShaderName(GLenum type);
|
static std::string ShaderName(GLenum type);
|
||||||
|
|
||||||
GLuint id_;
|
GLuint id_;
|
||||||
|
|
@ -54,7 +51,7 @@ GLuint ShaderProgram::id() const
|
||||||
|
|
||||||
GLint ShaderProgram::GetUniformLocation(const std::string& name)
|
GLint ShaderProgram::GetUniformLocation(const std::string& name)
|
||||||
{
|
{
|
||||||
GLint location = glGetUniformLocation(p->id_, name.c_str());
|
const GLint location = glGetUniformLocation(p->id_, name.c_str());
|
||||||
if (location == -1)
|
if (location == -1)
|
||||||
{
|
{
|
||||||
logger_->warn("Could not find {}", name);
|
logger_->warn("Could not find {}", name);
|
||||||
|
|
@ -114,16 +111,17 @@ bool ShaderProgram::Load(
|
||||||
const char* shaderSourceC = shaderSource.c_str();
|
const char* shaderSourceC = shaderSource.c_str();
|
||||||
|
|
||||||
// Create a shader
|
// Create a shader
|
||||||
GLuint shaderId = glCreateShader(shader.first);
|
const GLuint shaderId = glCreateShader(shader.first);
|
||||||
shaderIds.push_back(shaderId);
|
shaderIds.push_back(shaderId);
|
||||||
|
|
||||||
// Attach the shader source code and compile the shader
|
// Attach the shader source code and compile the shader
|
||||||
glShaderSource(shaderId, 1, &shaderSourceC, NULL);
|
glShaderSource(shaderId, 1, &shaderSourceC, nullptr);
|
||||||
glCompileShader(shaderId);
|
glCompileShader(shaderId);
|
||||||
|
|
||||||
// Check for errors
|
// Check for errors
|
||||||
glGetShaderiv(shaderId, GL_COMPILE_STATUS, &glSuccess);
|
glGetShaderiv(shaderId, GL_COMPILE_STATUS, &glSuccess);
|
||||||
glGetShaderInfoLog(shaderId, kInfoLogBufSize, &logLength, infoLog);
|
glGetShaderInfoLog(
|
||||||
|
shaderId, kInfoLogBufSize, &logLength, static_cast<GLchar*>(infoLog));
|
||||||
if (!glSuccess)
|
if (!glSuccess)
|
||||||
{
|
{
|
||||||
logger_->error("Shader compilation failed: {}", infoLog);
|
logger_->error("Shader compilation failed: {}", infoLog);
|
||||||
|
|
@ -172,6 +170,4 @@ void ShaderProgram::Use() const
|
||||||
glUseProgram(p->id_);
|
glUseProgram(p->id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace gl
|
} // namespace scwx::qt::gl
|
||||||
} // namespace qt
|
|
||||||
} // namespace scwx
|
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,9 @@ void ColorTableLayer::Initialize(const std::shared_ptr<MapContext>& mapContext)
|
||||||
|
|
||||||
glBindVertexArray(p->vao_);
|
glBindVertexArray(p->vao_);
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
// NOLINTBEGIN(modernize-use-nullptr)
|
||||||
|
|
||||||
// Bottom panel
|
// Bottom panel
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||||
glBufferData(
|
glBufferData(
|
||||||
|
|
@ -87,6 +90,7 @@ void ColorTableLayer::Initialize(const std::shared_ptr<MapContext>& mapContext)
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
|
|
||||||
// Color table panel texture coordinates
|
// Color table panel texture coordinates
|
||||||
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays)
|
||||||
const float textureCoords[6][1] = {{0.0f}, // TL
|
const float textureCoords[6][1] = {{0.0f}, // TL
|
||||||
{0.0f}, // BL
|
{0.0f}, // BL
|
||||||
{1.0f}, // TR
|
{1.0f}, // TR
|
||||||
|
|
@ -95,12 +99,17 @@ void ColorTableLayer::Initialize(const std::shared_ptr<MapContext>& mapContext)
|
||||||
{1.0f}, // TR
|
{1.0f}, // TR
|
||||||
{1.0f}}; // BR
|
{1.0f}}; // BR
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[1]);
|
||||||
glBufferData(
|
glBufferData(GL_ARRAY_BUFFER,
|
||||||
GL_ARRAY_BUFFER, sizeof(textureCoords), textureCoords, GL_STATIC_DRAW);
|
sizeof(textureCoords),
|
||||||
|
static_cast<const void*>(textureCoords),
|
||||||
|
GL_STATIC_DRAW);
|
||||||
|
|
||||||
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
|
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
|
||||||
glEnableVertexAttribArray(1);
|
glEnableVertexAttribArray(1);
|
||||||
|
|
||||||
|
// NOLINTEND(modernize-use-nullptr)
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
connect(mapContext->radar_product_view().get(),
|
connect(mapContext->radar_product_view().get(),
|
||||||
&view::RadarProductView::ColorTableLutUpdated,
|
&view::RadarProductView::ColorTableLutUpdated,
|
||||||
this,
|
this,
|
||||||
|
|
@ -154,6 +163,9 @@ void ColorTableLayer::Render(
|
||||||
if (p->colorTable_.size() > 0 && radarProductView->sweep_time() !=
|
if (p->colorTable_.size() > 0 && radarProductView->sweep_time() !=
|
||||||
std::chrono::system_clock::time_point())
|
std::chrono::system_clock::time_point())
|
||||||
{
|
{
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays)
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
// Color table panel vertices
|
// Color table panel vertices
|
||||||
const float vertexLX = 0.0f;
|
const float vertexLX = 0.0f;
|
||||||
const float vertexRX = static_cast<float>(params.width);
|
const float vertexRX = static_cast<float>(params.width);
|
||||||
|
|
@ -170,7 +182,10 @@ void ColorTableLayer::Render(
|
||||||
// Draw vertices
|
// Draw vertices
|
||||||
glBindVertexArray(p->vao_);
|
glBindVertexArray(p->vao_);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices);
|
glBufferSubData(GL_ARRAY_BUFFER,
|
||||||
|
0,
|
||||||
|
sizeof(vertices),
|
||||||
|
static_cast<const void*>(vertices));
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||||
|
|
||||||
static constexpr int kLeftMargin_ = 0;
|
static constexpr int kLeftMargin_ = 0;
|
||||||
|
|
@ -180,6 +195,9 @@ void ColorTableLayer::Render(
|
||||||
|
|
||||||
mapContext->set_color_table_margins(
|
mapContext->set_color_table_margins(
|
||||||
QMargins {kLeftMargin_, kTopMargin_, kRightMargin_, kBottomMargin_});
|
QMargins {kLeftMargin_, kTopMargin_, kRightMargin_, kBottomMargin_});
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-c-arrays)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,9 @@ void RadarProductLayer::Initialize(
|
||||||
void RadarProductLayer::UpdateSweep(
|
void RadarProductLayer::UpdateSweep(
|
||||||
const std::shared_ptr<MapContext>& mapContext)
|
const std::shared_ptr<MapContext>& mapContext)
|
||||||
{
|
{
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
// NOLINTBEGIN(modernize-use-nullptr)
|
||||||
|
|
||||||
boost::timer::cpu_timer timer;
|
boost::timer::cpu_timer timer;
|
||||||
|
|
||||||
std::shared_ptr<view::RadarProductView> radarProductView =
|
std::shared_ptr<view::RadarProductView> radarProductView =
|
||||||
|
|
@ -176,7 +179,7 @@ void RadarProductLayer::UpdateSweep(
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||||
timer.start();
|
timer.start();
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(GL_ARRAY_BUFFER,
|
||||||
vertices.size() * sizeof(GLfloat),
|
static_cast<GLsizeiptr>(vertices.size() * sizeof(GLfloat)),
|
||||||
vertices.data(),
|
vertices.data(),
|
||||||
GL_STATIC_DRAW);
|
GL_STATIC_DRAW);
|
||||||
timer.stop();
|
timer.stop();
|
||||||
|
|
@ -245,7 +248,10 @@ void RadarProductLayer::UpdateSweep(
|
||||||
glDisableVertexAttribArray(2);
|
glDisableVertexAttribArray(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
p->numVertices_ = vertices.size() / 2;
|
p->numVertices_ = static_cast<GLsizeiptr>(vertices.size() / 2);
|
||||||
|
|
||||||
|
// NOLINTEND(modernize-use-nullptr)
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadarProductLayer::Render(
|
void RadarProductLayer::Render(
|
||||||
|
|
@ -302,7 +308,7 @@ void RadarProductLayer::Render(
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_1D, p->texture_);
|
glBindTexture(GL_TEXTURE_1D, p->texture_);
|
||||||
glBindVertexArray(p->vao_);
|
glBindVertexArray(p->vao_);
|
||||||
glDrawArrays(GL_TRIANGLES, 0, p->numVertices_);
|
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(p->numVertices_));
|
||||||
|
|
||||||
if (wireframeEnabled)
|
if (wireframeEnabled)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue