fix(render): three warnings a stricter build reports, none of them behavioural
The point-index loop in `draw_traces` named its variable `i`, shadowing the trace index that the whole block is nested inside; it is `p` now, which also leaves the comment free to say which one is which. The marker loop's two screen coordinates were narrowed implicitly. And `same_cell()`'s only caller is an `assert`, so a release build had an unused function; it is guarded the way its caller is. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
c960decaea
commit
03c41adbec
2 files changed
+11
-6
No files matched your search
@@ -1043,8 +1043,8 @@ void Renderer::draw_traces(const Plot& plot, const PlotLayout& layout) {
|
||||
const f64 x_abs = series.x0() + static_cast<f64>(gather_[k]);
|
||||
const f64 y_abs = static_cast<f64>(gather_[k + 1]);
|
||||
if (!std::isfinite(x_abs) || !std::isfinite(y_abs)) continue;
|
||||
const f32 sx = xt.to_screen_x(x_abs);
|
||||
const f32 sy = yt.to_screen_y(y_abs);
|
||||
const f32 sx = static_cast<f32>(xt.to_screen_x(x_abs));
|
||||
const f32 sy = static_cast<f32>(yt.to_screen_y(y_abs));
|
||||
if (!(sx >= layout.axes.x && sx <= layout.axes.right() && sy >= layout.axes.y &&
|
||||
sy <= layout.axes.bottom())) {
|
||||
continue;
|
||||
@@ -1085,12 +1085,12 @@ void Renderer::draw_traces(const Plot& plot, const PlotLayout& layout) {
|
||||
usize kept = 0;
|
||||
f64 next = std::numeric_limits<f64>::infinity();
|
||||
for (usize k = count; k > 0; --k) {
|
||||
const usize i = k - 1u;
|
||||
const f64 x = static_cast<f64>(gather_[2u * i]) + series.x0();
|
||||
const usize p = k - 1u; // the point index; `i` above is the trace's
|
||||
const f64 x = static_cast<f64>(gather_[2u * p]) + series.x0();
|
||||
if (!(x < next)) continue; // out of order with what follows: unreadable, and a NaN too
|
||||
next = x;
|
||||
gather_[2u * (count - 1u - kept)] = gather_[2u * i];
|
||||
gather_[2u * (count - 1u - kept) + 1u] = gather_[2u * i + 1u];
|
||||
gather_[2u * (count - 1u - kept)] = gather_[2u * p];
|
||||
gather_[2u * (count - 1u - kept) + 1u] = gather_[2u * p + 1u];
|
||||
++kept;
|
||||
}
|
||||
if (kept != count) {
|
||||
|
||||
Reference in new issue
Block a user