Another round of clang-tidy fixes

This commit is contained in:
Dan Paulat 2025-07-11 23:04:31 -05:00
parent 8e9db6a2fe
commit 17af5e27ac
5 changed files with 62 additions and 50 deletions

View file

@ -78,6 +78,9 @@ void ColorTableLayer::Initialize(const std::shared_ptr<MapContext>& mapContext)
glBindVertexArray(p->vao_);
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
// NOLINTBEGIN(modernize-use-nullptr)
// Bottom panel
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
glBufferData(
@ -87,6 +90,7 @@ void ColorTableLayer::Initialize(const std::shared_ptr<MapContext>& mapContext)
glEnableVertexAttribArray(0);
// Color table panel texture coordinates
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays)
const float textureCoords[6][1] = {{0.0f}, // TL
{0.0f}, // BL
{1.0f}, // TR
@ -95,12 +99,17 @@ void ColorTableLayer::Initialize(const std::shared_ptr<MapContext>& mapContext)
{1.0f}, // TR
{1.0f}}; // BR
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[1]);
glBufferData(
GL_ARRAY_BUFFER, sizeof(textureCoords), textureCoords, GL_STATIC_DRAW);
glBufferData(GL_ARRAY_BUFFER,
sizeof(textureCoords),
static_cast<const void*>(textureCoords),
GL_STATIC_DRAW);
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
glEnableVertexAttribArray(1);
// NOLINTEND(modernize-use-nullptr)
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
connect(mapContext->radar_product_view().get(),
&view::RadarProductView::ColorTableLutUpdated,
this,
@ -154,6 +163,9 @@ void ColorTableLayer::Render(
if (p->colorTable_.size() > 0 && radarProductView->sweep_time() !=
std::chrono::system_clock::time_point())
{
// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays)
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
// Color table panel vertices
const float vertexLX = 0.0f;
const float vertexRX = static_cast<float>(params.width);
@ -170,7 +182,10 @@ void ColorTableLayer::Render(
// Draw vertices
glBindVertexArray(p->vao_);
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);
static constexpr int kLeftMargin_ = 0;
@ -180,6 +195,9 @@ void ColorTableLayer::Render(
mapContext->set_color_table_margins(
QMargins {kLeftMargin_, kTopMargin_, kRightMargin_, kBottomMargin_});
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
// NOLINTEND(cppcoreguidelines-avoid-c-arrays)
}
else
{

View file

@ -151,6 +151,9 @@ void RadarProductLayer::Initialize(
void RadarProductLayer::UpdateSweep(
const std::shared_ptr<MapContext>& mapContext)
{
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
// NOLINTBEGIN(modernize-use-nullptr)
boost::timer::cpu_timer timer;
std::shared_ptr<view::RadarProductView> radarProductView =
@ -176,7 +179,7 @@ void RadarProductLayer::UpdateSweep(
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
timer.start();
glBufferData(GL_ARRAY_BUFFER,
vertices.size() * sizeof(GLfloat),
static_cast<GLsizeiptr>(vertices.size() * sizeof(GLfloat)),
vertices.data(),
GL_STATIC_DRAW);
timer.stop();
@ -245,7 +248,10 @@ void RadarProductLayer::UpdateSweep(
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(
@ -302,7 +308,7 @@ void RadarProductLayer::Render(
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_1D, p->texture_);
glBindVertexArray(p->vao_);
glDrawArrays(GL_TRIANGLES, 0, p->numVertices_);
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(p->numVertices_));
if (wireframeEnabled)
{