四个方向 分块渲染

This commit is contained in:
2026-08-12 09:01:25 +08:00
parent b34c0d31b1
commit 9331b4cbf6
24 changed files with 788 additions and 108 deletions
+3 -10
View File
@@ -9,13 +9,6 @@ namespace renderive {
namespace detail {
namespace {
using Sweep_Spectrum_History = Plottable_History_Real_Time_Data<std::vector<double>, std::deque<std::vector<double>>>;
RectF axis_content_rect(const Axis_Transform& horizontal, const Axis_Transform& vertical) {
const double x1 = horizontal.coord_to_pixel(horizontal.coordinate_range.origin);
const double x2 = horizontal.coord_to_pixel(horizontal.coordinate_range.target);
const double y1 = vertical.coord_to_pixel(vertical.coordinate_range.origin);
const double y2 = vertical.coord_to_pixel(vertical.coordinate_range.target);
return {std::min(x1, x2), std::min(y1, y2), std::abs(x2 - x1), std::abs(y2 - y1)};
}
std::vector<double> flatten(const std::deque<std::vector<double>>& blocks) {
std::vector<double> values;
for(const auto& block : blocks)
@@ -74,9 +67,9 @@ void Sweep_Spectrum_Control::paint(Painter& painter, const Render_State_View& vi
painter.polyline(curve_points(values, state.frequency_range, x, y, state.visible_range_only, state.interpolation_mode), state.pen);
const double completed = std::min(1.0, static_cast<double>(blocks.size()) / state.block_count.get());
const double frequency = state.frequency_range.origin + state.frequency_range.length() * completed;
const RectF content = axis_content_rect(x, y);
const double marker_x = x.coord_to_pixel(frequency);
painter.line({marker_x, content.y}, {marker_x, content.bottom()}, state.current_frequency_pen);
painter.line(mapped_point(x, frequency, y, y.coordinate_range.origin),
mapped_point(x, frequency, y, y.coordinate_range.target),
state.current_frequency_pen);
}
}
}