策略抽离

This commit is contained in:
2026-08-02 14:20:27 +08:00
parent 6d000f43b4
commit 2df8959ed6
87 changed files with 2454 additions and 1390 deletions
+20 -11
View File
@@ -1,28 +1,37 @@
#include "Latency_Eager_Plot_p.h"
namespace renderive {
Latency_Eager_Plot_Private::Latency_Eager_Plot_Private()
: Abs_Plot_Private(std::make_unique<Latency_Eager_Refresh_Strategy>()) {
latency_strategy = static_cast<Latency_Eager_Refresh_Strategy*>(strategy);
: Abs_Plot_Private(std::make_unique<Low_Latency_Frame_Flow>()) {
latency_flow = static_cast<Low_Latency_Frame_Flow*>(flow);
}
Latency_Eager_Plot::Latency_Eager_Plot()
: Abs_Plot(new Latency_Eager_Plot_Private()) {}
void Latency_Eager_Plot::start() {
d->core->activate_view();
}
void Latency_Eager_Plot::pause() {
d->core->deactivate_view();
}
bool Latency_Eager_Plot::running() const {
return d->core->view_active();
}
double Latency_Eager_Plot::max_render_fps() const {
auto* data = static_cast<Latency_Eager_Plot_Private*>(d);
return data->latency_strategy ? data->latency_strategy->max_render_fps() : 0.0;
return data->latency_flow ? data->latency_flow->max_render_fps() : 0.0;
}
void Latency_Eager_Plot::set_max_render_fps(double fps) {
auto* data = static_cast<Latency_Eager_Plot_Private*>(d);
if (data->latency_strategy) {
data->latency_strategy->set_max_render_fps(fps);
data->core->mark_render_state_dirty();
if (data->latency_flow) {
data->latency_flow->set_max_render_fps(fps);
data->core->notify_model_dirty();
}
}
Low_Latency_Diagnostics Latency_Eager_Plot::diagnostics() const {
auto* data = static_cast<Latency_Eager_Plot_Private*>(d);
return data->latency_flow ? data->latency_flow->low_latency_diagnostics() : Low_Latency_Diagnostics{};
}
Refresh_Control_Snapshot Latency_Eager_Plot::refresh_feedback_snapshot() const {
auto* data = static_cast<Latency_Eager_Plot_Private*>(d);
return data->latency_strategy ? data->latency_strategy->feedback_state() : Refresh_Control_Snapshot{};
}
void Latency_Eager_Plot::start_render(int max_render_fps) {
set_max_render_fps(max_render_fps);
Abs_Plot::start_render();
return data->latency_flow ? data->latency_flow->feedback_state() : Refresh_Control_Snapshot{};
}
} // namespace renderive