Trim main task queue, recording label, and canvas draw callbacks
This commit is contained in:
@@ -4,11 +4,14 @@
|
||||
|
||||
#include "app.h"
|
||||
#include "canvas.h"
|
||||
#include "app_core/app_status.h"
|
||||
#include "legacy_app_dialog_services.h"
|
||||
#include "legacy_ui_overlay_services.h"
|
||||
#include "node_progress_bar.h"
|
||||
|
||||
namespace pp::panopainter {
|
||||
void update_legacy_recording_frame_label(App& app);
|
||||
|
||||
namespace {
|
||||
|
||||
pp::app::RecordingWorkerIterationPlan make_recording_worker_iteration_plan(App& app)
|
||||
@@ -42,9 +45,25 @@ void encode_recording_frame(
|
||||
LOG("rec frame encoded");
|
||||
|
||||
if (plan.update_frame_label)
|
||||
app.update_rec_frames();
|
||||
update_legacy_recording_frame_label(app);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void update_legacy_recording_frame_label(App& app)
|
||||
{
|
||||
if (auto txt = app.layout[app.main_id]->find<NodeText>("txt-rec"))
|
||||
{
|
||||
const auto label = pp::app::make_recording_frame_label(
|
||||
app.rec_running,
|
||||
Canvas::I->m_encoder != nullptr,
|
||||
Canvas::I->m_encoder ? Canvas::I->m_encoder->frames_count() : 0);
|
||||
txt->set_text(label.text.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class LegacyRecordingServices final : public pp::app::RecordingServices {
|
||||
public:
|
||||
explicit LegacyRecordingServices(App& app) noexcept
|
||||
@@ -54,7 +73,7 @@ public:
|
||||
|
||||
void start_thread() override
|
||||
{
|
||||
app_.update_rec_frames();
|
||||
update_legacy_recording_frame_label(app_);
|
||||
app_.rec_thread = std::jthread(&App::rec_loop, &app_);
|
||||
}
|
||||
|
||||
@@ -65,7 +84,7 @@ public:
|
||||
app_.rec_cv.notify_all();
|
||||
if (app_.rec_thread.joinable())
|
||||
app_.rec_thread.join();
|
||||
app_.update_rec_frames();
|
||||
update_legacy_recording_frame_label(app_);
|
||||
}
|
||||
|
||||
void delete_recorded_files() override
|
||||
@@ -80,7 +99,7 @@ public:
|
||||
|
||||
void update_frame_label() override
|
||||
{
|
||||
app_.update_rec_frames();
|
||||
update_legacy_recording_frame_label(app_);
|
||||
}
|
||||
|
||||
void begin_export(int progress_total) override
|
||||
|
||||
Reference in New Issue
Block a user